Need help with run script to put it on loop [the animation]

So I’ve been working on a roguelike game and I got this run script but it plays the run animation once then it stops I would like to know if there a way to fix that without remaking the whole script

this is the script

local UIS = game:GetService(‘UserInputService’)
local Player = game.Players.LocalPlayer
local Character = Player.Character

UIS.InputBegan:connect(function(input)–When a player has pressed LeftShift it will play the animation and it will set the normal walking speed (16) to 35.
if input.KeyCode == Enum.KeyCode.LeftControl then
Character.Humanoid.WalkSpeed = 35
local Anim = Instance.new(‘Animation’)
Anim.AnimationId = ‘rbxassetid://5345597238’
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
end
end)

UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
Character.Humanoid.WalkSpeed = 16
PlayAnim:Stop()
end
end)

So I have not yet try to do anything due to I don’t want the script to break

its a local script named localscript in player in the starter gui

Open the animation in the editor and enable the looped property, here is an image of how the button looks:

Then ensure you re-export the animation to the current one your using.

Where is the editor? Like how do I open the animation

Hello. The editor is here:


Hope you found.

1 Like