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

How do make it so you can press left click and an animation will play?

I'we made the animation now in need a left click event script that makes it play oh andmake it to damge too. As ussually im making it for my nice gun game.

Oh and I almost forgot that you need an tool to make it hapend.

I will be very happy if someone wil anwser this!

1 comment

0

sorry for the text being very badly whiten im and Estonian so i don't speak English

1 answer

Hello marcus,

This script I made should work. Make sure to set the animation priority to "Action" if you want it to override other ongoing animations.

wait()
local tool = script.Parent

local humanoid = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")

local animation = Instance.new("Animation")
animation.AnimationId =	"rbxassetid://6436133809" -- ANIMATION ID GOES IN HERE!

tool.Activated:Connect(function()
		print("click")
		local animTrack = humanoid:LoadAnimation(animation)
		animTrack:Play()
		animTrack.Looped = false -- SET THIS TO TRUE IF YOU WANT THE ANIMATION TO LOOP.
end)

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