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

how do i make an animation trigger script? [closed]

Asked by 6 years ago

How do i give a player an animation when it touched something like lava, could you also say how i give the player a flame effect or a particle effect for like 3 seconds

-thanks

Closed as Not Constructive by RubenKan

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

Put an animation inside the script named Animation, set the Animation ID to the ID of the animation you want, then put this script in the brick

local Anim = script:WaitForChild("Animation")
local debounce = false

script.Parent.Touched:Connect(function(hit)
    if (not debounce) and hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid:FindFirstChild("Animator") and hit.Parent:FindFirstChild("HumanoidRootPart") then
        debounce = true
        local track = hit.Parent.Humanoid.Animator:LoadAnimation(Anim)
        track:Play()
        local particles = Instance.new("ParticleEmitter")
        particles.Parent = hit.Parent.HumanoidRootPart
        wait(3) -- set to how long you want the particles to last for
        particles.Enabled = false
        debounce = false
        wait(10)
        particles:Destroy()
    end
end)
Ad