#Playerball script not working

1 messages · Page 1 of 1 (latest)

long laurel
#

After finding a tutorial on how to to make the player a ball and tinkering it to fit my roblox game, it still doesnt work when the part (that sends a remote event to the scripts I used) is touched .still cant figure out how to do this. Pls help

#
local event = game.ReplicatedStorage.MakePlayerBallSignal
local part = game.Workspace.ConvertToBallPart
local Runservice = game:GetService("RunService")

event.OnServerEvent:Connect(function(PlayerModel)
    part.Touched:Connect(function(otherpart)
        local char = otherpart.Parent
        local HRP = char:WaitForChild("HumanoidRootPart")
        local marble = game.ServerStorage:WaitForChild("Marble"):Clone()
        marble.Parent = char
        marble.Position = HRP.Position
        local Velocity = Instance.new("BodyAngularVelocity")
        Velocity.Parent = marble
        local Hum = char:WaitForChild("Humanoid")
        local Weld = Instance.new("Weld")
        Weld.Parent = marble
        Weld.Part0 = HRP
        Weld.Part1 = marble
        Hum.PlatformStand = true

        Runservice:BindToRenderStep("BallCalc", 2, function()
            game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:Connect(function()
                if game.Players.LocalPlayer.Character:FindFirstChild("Marble") then
                    game.Players.LocalPlayer.Character:FindFirstChild("Marble"):Destroy()
                end
            end)

        end)
    end)
end)
#
local event = game.ReplicatedStorage.MakePlayerBallSignal
event.OnClientEvent:Connect(function(PlayerModel)
    game:GetService("RunService").RenderStepped:Connect(function()
        if game.Players.LocalPlayer.Character:FindFirstChild("Marble") then
            local camera = game.Workspace.CurrentCamera
            camera.CameraType = Enum.CameraType.Custom
            camera.CameraSubject = game.Players.LocalPlayer.Character.Marble
        else
            local camera = game.Workspace.CurrentCamera
            camera.CameraType = Enum.CameraType.Custom
            camera.CameraSubject = game.Players.LocalPlayer.Character.Head
        end
    end)    
    
    game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:Connect(function()
        if game.Players.LocalPlayer.Character:FindFirstChild("Marble") then
            game.Players.LocalPlayer.Character:FindFirstChild("Marble"):Destroy()
        end
    end)
    
    
end)
#

The first script is from the server side, and the 2nd one is the client side

covert isle
#

Can you elaborate on your issue a bit more? Exactly what isn’t working? Are there any errors?