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

how do i make an animation trigger script?

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

1 answer

✓ Accepted answer

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)

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