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

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

Asked by 3 years ago
Edited 3 years ago

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!

0
sorry for the text being very badly whiten im and Estonian so i don't speak English marcusmitevaal -1 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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)
Ad

Answer this question