Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do i make My Idle Animation Change when I Press a Key?

Asked by 3 years ago

I have an idle animation That I Want to Play when I press a Key And I want it To change back when i Press it again

StyleStorage = game.ServerStorage
local character = script.Parent
local stylename = script:WaitForChild("StyleName")
local using = script:WaitForChild("Using")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local usingCheck = script:WaitForChild("UsingCheck")
--Basic--

mouse.KeyDown:connect(function(key)
    if key:lower() == "e" or key:upper() == "E" and usingCheck.Value == false then
        using.Value = true
        usingCheck = true
    else
        using.Value = false

    if stylename.Value == "Basic" and using.Value == true then
            character.Animate.idle.Animation1.AnimationId = "rbxassetid://7044204863"
            usingCheck = false
        else

                 if using.Value == false then
                    character.Animate.idle.Animation1.AnimationId = "rbxassetid://507766388"
                end

            end
    end

end)

Answer this question