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

How can I make an animation play on button hit?

Asked by 10 years ago

In my game, players are supposed to have a custom animation to walk, but I don't know how to trigger the animation on key hit. (Like, the player presses "W" and the animation plays).

Thank you.

2 answers

Log in to vote
0
Answered by 10 years ago

You have to use the animation plugin to create a walking animation, then pay 30 robux to upload it for use. Then you right the script for the animation to play when the player presses "w"

Ad
Log in to vote
0
Answered by 9 years ago

You could use this script:

--Made by Tynexx

--Fixed by iDarrick





game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local ani = char:FindFirstChild("Animate")
if ani then
ani:Destroy()
local nani = game.Lighting.NewAnimation
if nani then
nani:Clone().Parent = char
end
end
end)
end)

Just go into studio, click tools, test, and play solo. Go to the model in workspace called "Player1". Copy the script "Animate". Go into the script and replace the id in "walk" with your animation's ID. Also, go into the StringValue "walk" and it's child animation "WalkAnim" And put the same ID you put in the Script there. Hope this helps!

Answer this question