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

Script to disable movement of the player isn't working?

Asked by
zomspi 541 Moderation Voter
4 years ago

I am trying to disable movement when a gui is open and enable it when the gui is closed, this is what I have but it doesn't work.


game:WaitForChild("Players").PlayerAdded:Connect(function(player) game.StarterGui.MapOpenClose.ImageButton.MouseButton1Click:Connect(function() player.CharacterAppearanceLoaded:Connect(function(character) if game.StarterGui.Map.Frame.Visible == true then character.Humanoid.WalkSpeed = 0 end end) end) game:WaitForChild("Players").PlayerAdded:Connect(function(player) game.StarterGui.MapOpenClose.ImageButton.MouseButton1Click:Connect(function() if game.StarterGui.Map.Frame.Visible == false then player.CharacterAppearanceLoaded:Connect(function(character) character.Humanoid.WalkSpeed = 30 end) end end) end) end)

Answer this question