I'm trying to make a sleeping animation but you stay sleeping even when you move.
prefix = "/e "
game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(m)
m = m:lower()
if m == prefix.."sleep" then
local a = Instance.new("Animation",p.Character)
a.AnimationId = "rbxassetid://2053583627"
local h = p.Character:FindFirstChild'Humanoid'
local t = h:LoadAnimation(a)
t:Play()
workspace.Player.Humanoid.Running:connect(function(speed)
if speed > 0 then
t:Stop()
end
end)
end
end)
end)
Thanks if you can help
