Still have questions? Join our Discord server and get real time help.
0

# [SOLVED] How to disable player's movement?(wait() did the trick)

Edited 2 months ago
UIS = game:GetService("UserInputService")
plr = game.Players.LocalPlayer
hum = ctr:WaitForChild('Humanoid')
an = Instance.new("Animation")
an.AnimationId = "https://www.roblox.com/asset?id=".."2695066337"--id
db = true
strength = plr:WaitForChild("Stats"):WaitForChild("Strength")
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.T and db == true then

db = false
local speed = hum.WalkSpeed
strength.Value = strength.Value + 10
antrack:Play()
wait(2)
speed = nil
db = true
end
end)


I've made this script and I've tried anchoring humanoidrootpart and the player can still move. I made the walkspeed and jump power 0 but the animation just stopped working or if you don't get it the animation only partly works by just rotating a slightly bit then going back to normal

My goal: Make the player do the animation and stop moving or jumping when clicked t.

0
I have given an answer. WideSteal321 451 — 2mo
0
Srsly? WideSteal321 451 — 2mo

2
Edited 2 months ago

EDITED

UIS = game:GetService("UserInputService")

an = Instance.new("Animation")
an.AnimationId = "https://www.roblox.com/asset?id=".."2695066337"--id
db = true

strength = plr:WaitForChild("Stats"):WaitForChild("Strength")
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.T and db == true then

db = false
strength.Value = strength.Value + 10
antrack:Play()
wait(2)
char.Humanoid.WalkSpeed = 1--// We are changing Walkspeed to 1
char.Humanoid.JumpPower =1 --// We are changing JumpPower to 1
db = true
end
end)


If I cannot help further please use this to help you make it yourself (or if no-one else helps or their answers don't work):

game.Players.PlayerAdded:Connect(function(plr)

char.Humanoid.JumpPower = 1
char.Humanoid.WalkSpeed = 1

end)
end)

0
ok i do get u and I've tried this before. In my question I clearly state i made them both 0 but it didn't work. What I meant by that is that when I do a push up while im walking the push up animation just breaks off HappyTimIsHim 164 — 2mo
0
Try 1? They will be able to move yet very little. WideSteal321 451 — 2mo
0
oh yeah i can do that HappyTimIsHim 164 — 2mo