local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()

local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=3190873930"
anim.Parent = game.ServerScriptService

mouse.KeyDown:connect(function(key)
	if key == "e" then
		local playAnim = humanoid:LoadAnimation(anim)
		playAnim:Play()
		humanoid.WalkSpeed = 0
		wait(2.5)
		humanoid.WalkSpeed = 16
		playAnim:Stop()
	end
end)

whats the problem in this code? im trying to make myself do the animation and make my character stop walking.

1 comment

0

First, I suggest moving the playAnim:Play() below where you set their walkspeed to 0. Also if this is on the client then don't reference the server. Parent the animation to the character or something. Lastly if all that doesn't work make sure your animation works in the first place.