Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

So i want to stop the animation when my character's walkspeed changes from 0, how?

Asked by 3 days ago
Edited 3 days ago
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local char = player.Character
local hum = char.Humanoid
local running = false
local UIS = game:GetService("UserInputService")
local ToggleSusan = game.ReplicatedStorage:WaitForChild("ToggleSusan")

UIS.InputBegan:Connect(function(Input, Chat)
    if Input.KeyCode == Enum.KeyCode.E and not Chat and hum.Health >= 1 then
        if running == false then
            ToggleSusan:FireServer(true)
            local Anim = Instance.new('Animation')
            Anim.AnimationId = script.Idle.AnimationId
            PlayAnim = char.Humanoid:LoadAnimation(Anim)
            PlayAnim:Play()

            running = true
        elseif running == true then
            ToggleSusan:FireServer(false)
            PlayAnim:Stop()
            running = false
        elseif running == true then

            if hum.walkspeed > 0 then

                PlayAnim:Stop() 
        end




        end
    end
end)

so this is what i did, u see and the buttom i tried it so when the Walkspeed is bigger than 0 the animation stop but it doesn't do anything any help is apreaciated

Answer this question