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

Skill animation won't play on button press?

Asked by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
9 years ago

I've made an animation, and exported it. I'm trying to make the animation play when the player presses one, but it doesn't play. How do I fix it?

This script is located in a LocalScript in StarterPack:

player = game.Players.LocalPlayer
local fireballanimation = Instance.new("Animation", player.Character)
fireballanimation.AnimationId = "rbxassetid://319164260"
fireballanimation.Name = "Fireball Animation"

local animFireball = player.Character.Humanoid:LoadAnimation(fireballanimation)

function fireball()
    animFireball:Play()
    -- Fireball happens
end


function keybarClick()
    if s1s == "Fireball" then
        if fireballcooldown == false then
            fireballcooldown = true

            fireball()

            wait(fireballcdt)
            fireballcooldown = false
            print("Fireball ready")
        end
        end
end 

function skillCheck(inputObject, gameProcessedEvent)

    if inputObject.KeyCode == Enum.KeyCode.One then
        keybarClick()
    end
end 

Thanks in advance!

1
Try adding a wait(1) at the start drslicendice 27 — 9y
0
I added 'repeat wait() until player.Character' right before returning to add the solution, thanks though! Pyrondon 2089 — 9y

Answer this question