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

How do i animated a rig on a part click?

Asked by 2 years ago

I have been trying to animated a rig but i dont know how. this is my first time so i dont really know what im doing but i have made the animation ID and all of that stuff, but i just dont know how to place it within code. also i dont want to use it in a person i just want the rig to do it, like it just dancing on a click of a oart if that makes any sence

1 answer

Log in to vote
0
Answered by
Ludzik78 136
2 years ago

Create a ClickDetector in the Part, then, in the part. Create a Script. Also, create a Animation in the part and change the animation ID to that animation ID. In the script, write this:

local ClickDetect = script.Parent
local Anim = script.Parent.Parent.Animation
ClickDetect.MouseClick:Connect(function(player)
    local Humanoid = player.Character.Humanoid
    if Humanoid then
        local Track = Humanoid:LoadAnimation(Anim)
        Track:Play()
    end
end)
Ad

Answer this question