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

How to trigger animation when button is clicked?

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:

script.Parent.Jump.MouseButton1Click:Connect(function()
	animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.JumpAnim)
	animation:Play()
end)

script.Parent.Cheer.MouseButton1Click:Connect(function()
	animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.CheerAnim)
	animation:Play()
end)

script.Parent.Wave.MouseButton1Click:Connect(function()
	animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.WaveAnim)
	animation:Play()
end)

script.Parent.Kick.MouseButton1Click:Connect(function()
	animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.KickAnim)
	animation:Play()
end)

script.Parent.Float.MouseButton1Click:Connect(function()
	animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.Workspace.FloatAnim)
	animation:Play()
end)

1 answer

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.

1 comment

0

Sorry i cant post an example, im on my phone right now.

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