This script does so that a anim plays when your walking sideways but the problem is that this happends:
Stop is not a valid member of Animation "Animation" Play is not a valid member of Animation "Animation" Why??
Heres the localscript:
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
local leftWalk = Instance.new("Animation")
leftWalk.AnimationId = "rbxassetid://6046738829"
local rightWalk = Instance.new("Animation")
rightWalk.AnimationId = "rbxassetid://6046765944"
hum:LoadAnimation(leftWalk)
hum:LoadAnimation(rightWalk)
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.D then
print("Going Right")
rightWalk:Play()
elseif input.KeyCode == Enum.KeyCode.A then
print("Going Left")
leftWalk:Play()
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.D then
print("Animation Stop")
rightWalk:Stop()
elseif input.KeyCode == Enum.KeyCode.A then
print("Animation Stop")
leftWalk:Stop()
end
end)

2 comments
Oh ok thank you!!
I would appreciate if you accepted this answer if it helped you. We both get rep for it.