Ok so i want to make a Sprint animation, And of course this is the code, When i put the Animation inside there, It says "Play and Stop is not a valid Member of Animation."
local inputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local animation = Instance.new("Animation")
local normalSpeed = 15 -- The player's speed while not sprinting
local sprintSpeed = 25 -- The player's speed while sprinting
local sprinting = false
inputService.InputBegan:Connect(function (key)
if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.LeftControl then
running = true
if char.Humanoid then
char.Humanoid.WalkSpeed = sprintSpeed
animation.AnimationId = "http://www.roblox.com/asset/?id=5627066906"
animation:Play()
end
end
end)
inputService.InputEnded:Connect(function (key)
if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.LeftControl then
running = false
if char.Humanoid then
char.Humanoid.WalkSpeed = normalSpeed
animation:Stop()
end
end
end)

2 comments
Test it again
I believe you're looking for AnimationTrack:Play().