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

Animation Upon Touch of a Brick?

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?

2 comments

0

the wiki page explains it

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

1 answer

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

3 comments

0

Thanks! I wasn't asking for an exact script (morelike just the parent.touched and trigger) but this helps a bunch!

0

I just used this script and it stil works!

0

Still works :)

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