So uhm, im rlly tired right now, and spent way more time on this small issue, and yet idk how to do it. Basically i want this animation to play when player is runnig, and it works, the animations starts and stops when player stops, problem is, when the player restarts after stopping, animation wont play again, i tried with MoveDirection, WalkSpeed, Loops. As i said, it’s prob a small thing, but i’m just tired at this point.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://18758784377'
local PlayAnim = character.Humanoid:LoadAnimation(Anim)
local togleLOL = false
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.LeftControl and togleLOL == false then
PlayAnim:Play()
togleLOL = true
humanoid.WalkSpeed = 35
elseif input.KeyCode == Enum.KeyCode.LeftControl and togleLOL == true then
PlayAnim:Stop()
togleLOL = false
humanoid.WalkSpeed = 8
end
end)
if humanoid.WalkSpeed == 35 and humanoid.MoveDirection.Magnitude > 0 then
PlayAnim:Play()
end
while wait() do
if humanoid.WalkSpeed == 35 and humanoid.MoveDirection.Magnitude == 0 then
PlayAnim:Stop()
end
end