Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Animation on key down?

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

1 comment

0

Where the script at tho? This isn't a request site my friend.

1 answer

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. :)

1 comment

0

P.S Join Xora Stduio :)

This discussion is preserved as it was. New answers, comments, and votes are closed.