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

Animation Upon Touch of a Brick?

Asked by 8 years ago

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?

0
the wiki page explains it EssentialRoll 30 — 8y
0
can you give me the exact sentence/code block/paragraph from the wiki? i really need to know how to do this because various areas in this game require different animations aquadrious 53 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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 ;).

0
Thanks! I wasn't asking for an exact script (morelike just the parent.touched and trigger) but this helps a bunch! aquadrious 53 — 8y
0
I just used this script and it stil works! Papas_Pringles 0 — 4y
0
Still works :) BenJaminZooey 9 — 3y
Ad

Answer this question