So I've been snooping around the ROBLOX Wiki to see if I could find the article on animation and I did -- and I found a script that apparently "plays an animation when a player touches the electric fence." However, I do not understand how it triggers upon event. Can someone give me an example of animation when touching a brick so I can understand it a little easier?
Put this script inside a part.
local Anim = script.Parent.Animation -- Animation local debounce = false script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and debounce == false then debounce = true local AnimTrack = hit.Parent.Humanoid:LoadAnimation(Anim) AnimTrack:Play() wait(2) -- Seconds Before You Can Play Animation Again. debounce = false end end)
I didn't test this ;).