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

What's the best way to play an animation if clicked?

I don't know how to play an animation when RMB is activated/ clicked. Please help. Thank you! <3

1 comment

0

These types of questions is already asked in the dev forums.

1 answer

✓ Accepted answer
--LocalScript
local plr = game.Players.LocalPlayer;
local mouse = plr:GetMouse() --we got the mouse
local ID = "put id of animation here" --make sure you only put the numbers

mouse.Button2Up:Connect(function() --When we right click
	local anim = Instance.new("Animation") --makes an animation
	anim.AnimationId = "rbxassetid".. tostring(ID) --sets the ID
	local track = plr.Character.Humanoid:LoadAnimation(anim) --loads the track to the player's humanoid
	track:Play() --plays the animation
end)

Please make an attempt to solve your problem, this isn't a request site.

2 comments

1

I don't understand why people keep on telling me that even though all I'm trying to do is to learn by giving myself challenges. "I'm trying my hardest to learn!" :( Thank you anyways.

0

No worries, I just got the idea you went around asking for scripts based on your reputatation.

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