while true do
wait(0.1)
if game.Players.LocalPlayer.leaderstats.Stop.Value == 1 then
RunService:BindToRenderStep('Control', Enum.RenderPriority.Input.Value,
onUpdate)
ContextActionService:BindAction('Left', onLeft, true, 'a', Enum.KeyCode.Left,
Enum.KeyCode.DPadLeft)
ContextActionService:BindAction('Right', onRight, true, 'd', Enum.KeyCode.Right,
Enum.KeyCode.DPadRight)
ContextActionService:BindAction('Jump', onJump, true, 'w', Enum.KeyCode.Space,
Enum.KeyCode.Up, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA)
end
if game.Players.LocalPlayer.leaderstats.Stop.Value == 0 then
print("SSSSSS")
RunService:BindToRenderStep('Control', Enum.RenderPriority.Input.Value,
onUpdate)
ContextActionService:BindAction('Left', onLeft, false, 'a', Enum.KeyCode.Left,
Enum.KeyCode.DPadLeft)
ContextActionService:BindAction('Right', onRight, false, 'd', Enum.KeyCode.Right,
Enum.KeyCode.DPadRight)
ContextActionService:BindAction('Jump', onJump, false, 'w', Enum.KeyCode.Space,
Enum.KeyCode.Up, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA)
end
end
So, this script it's supposed to not allow player movement if a leaderstat called "stop" == 0. It's a snippet of a larger script, but this is all that really matters.
Yes, it does register whenever the value is changed i checked.
Can someone tell me what i did wrong here?
PS ( Yes hiimgoodpack, I indented specifically so you wouldn't put me on your kill list.)

4 comments
The lua formatting on this website messed up the formating... ;(. Sorry hiimgoodpack
You are binding the functions 10 times a second. That means when you move theres going to be like a thousand functions firing.
Couldn't you just get the local player's HumanoidRootPart and, if it exists, set its .Anchored to "game.Players.LocalPlayer.leaderstats.Stop.Value == 1"?
No, because then if the player is in mid air, it will float.