0

# How do i make a run animation play when The player has begun running?

So I made a Shift to run script, yet I am kind of stuck on something. How do I make an animation play when the player has begun running?

Heres the script:

> local UserInputService = game:GetService("UserInputService")

local Character = script.Parent local Humanoid = Character:WaitForChild("Humanoid") local isRunning = false local runanim = game.ServerStorage.anims.Animation

UserInputService.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then if not isRunning then isRunning = true Humanoid.WalkSpeed = 32 runanim:Play() else Humanoid.WalkSpeed = 16 runanim:Stop() isRunning = false end end end)

Someone please help me with this, i think that it is the runanim:Play() / runanim:Stop() parts, yet i need something to confirm this for me or send me a fixed version of the script, Thanks for reading.

0
Edited 5 days ago

the script works fine, you just need to change something, make the script to script and not a local script and put it in serverscriptservice

and change these

local runanim = game.ServerStorage.anims.Animation
local clone = runanime:Clone()

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.LeftShift then
if gameProcessed then
character.Humanoid.WalkSpeed = 32
runanim.Parent = character.Humanoid