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

How to trigger animation when button is clicked?

Asked by 4 years ago

Not really a scripting question, but I have a script that plays an animation, but no one else can actually "do" the animation, because they do not own the animation. Is there a way to work around this? Here's my code btw:

01script.Parent.Jump.MouseButton1Click:Connect(function()
02    animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.JumpAnim)
03    animation:Play()
04end)
05 
06script.Parent.Cheer.MouseButton1Click:Connect(function()
07    animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.CheerAnim)
08    animation:Play()
09end)
10 
11script.Parent.Wave.MouseButton1Click:Connect(function()
12    animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.WaveAnim)
13    animation:Play()
14end)
15 
View all 24 lines...

1 answer

Log in to vote
0
Answered by 4 years ago

I would use the UserInputService, and when they press a key, it plays an Animation. I would put this into a local script, inside starter pack.

0
Sorry i cant post an example, im on my phone right now. mcslimeman 37 — 4y
Ad

Answer this question