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

Animation on key down?

Asked by 9 years ago

Ive tried to create a onKeyDown play animation script but nothing works help??

0
Where the script at tho? This isn't a request site my friend. GreekGodOfMLG 244 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Put this in a LocalScript, then put your animation into the LocalScript: THIS IS CRUCIAL. Once your done put the LocalScript into StarterGui or StarterPack

local Mouse = game.Players.LocalPlayer:GetMouse();

player = game.Players.LocalPlayer

animation = script:WaitForChild("Name of animation") 

enabled = true

Mouse.KeyDown:connect(function(key)
if (Key:lower() == "") then)   -- Put the key you want in between ""
    if enabled then
        enabled = false

        local animationTrack = player.Character.Humanoid:LoadAnimation(animation)
        animationTrack:Play()

        wait(5)  -- How long you want it to take before you use it again.
        enabled = true
    end
end)

I hope this helped, don't forget to accept the answer if it does. :)

0
P.S Join Xora Stduio :) kingstephen23 35 — 9y
Ad

Answer this question