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

Animation Not Playing On Command?

Asked by 2 years ago
local Input = require(script.Parent:WaitForChild("Input"))

local Character = script.Parent.Parent
local Humanoid = Character.Humanoid

local ParadeRest = script:WaitForChild("ParadeRest")
local HandSalute = script:WaitForChild("HandSalute")
local Attention = script:WaitForChild("Attention")

local HandSaluteDebounce = false
local AttentionDebounce = false
local ParadeRestDebounce = false

local HandSaluteAnimation = Humanoid:LoadAnimation(HandSalute)
local ParadeRestAnimation = Humanoid:LoadAnimation(ParadeRest)
local AttentionAnimation = Humanoid:LoadAnimation(Attention)

Input.BindKeyPresses("HandSalute",function()
    if HandSaluteDebounce == false then
        HandSaluteDebounce = true
        HandSaluteAnimation:Play()
    elseif HandSaluteDebounce == true then
        HandSaluteDebounce = false
        HandSaluteAnimation:Stop()
    end
end, Enum.KeyCode.LeftControl, Enum.KeyCode.H)

The input function works perfectly fine, I've tested it before. It's just the animation, there are no errors when it runs, so if you could help me out that would be great. I want the animation to be toggleable. That's why there is a debounce, but it's not actually I debounce It's just the toggle system.

0
Hmmm.. I don’t know what’s wrong.. maybe try checking if you have any unnecessary variables? ZIRFAL3 17 — 2y
0
Or try getting the character variable with that wait for character function thingy ZIRFAL3 17 — 2y
0
It’s like 2am where I live and my brain is deactivated ZIRFAL3 17 — 2y

Answer this question