Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this marble script a glitchy/buggy mess?

Asked by 9 years ago

So im trying to put the players character in a ball so the character and ball roll around. But for some reason 2 balls get cloned and the actual ball doesnt want to roll

01local go = false
02 
03script.Parent.Touched:connect(function(hit)
04    if go == false then
05        go = true
06        if hit.Parent:FindFirstChild("Humanoid") then
07            local player = game.Players:GetPlayerFromCharacter(hit.Parent)
08            player.PlayerScripts.ControlScript.Disabled = true
09            local clone = workspace.Marble:Clone()
10            clone.Parent = hit.Parent.Torso
11            clone.CFrame = workspace.MarbleSpawn.CFrame
12            clone.Anchored = false
13            local weld = Instance.new("Weld")
14            weld.Parent = clone
15            weld.Part0 = clone
View all 22 lines...
1game.Lighting.Marble.OnClientEvent:connect(function()
2    game.Players.LocalPlayer.Character.Humanoid:SetStateEnabled("GettingUp",false)
3    game.Players.LocalPlayer.Character.Humanoid:SetStateEnabled("PlatformStanding",true)
4    game.Players.LocalPlayer.Character.Torso:WaitForChild("Marble").Rotation = Vector3.new(0,160,0)
5    wait(1)
6    game.Players.LocalPlayer.Character.Torso:WaitForChild("Marble").Rotation = Vector3.new(0,200,0)
7end)

1 answer

Log in to vote
0
Answered by
Scerzy 85
9 years ago

I'm sorry if this isn't correct because I'm not that great of a scripter but I think the script keeps repeating itself because it keeps detecting that "go" is false. When you set it to false at the end the script checks to see if it's false, and since it is it runs through itself again. Then go is set to false again and it continues.

Ad

Answer this question