They should perform an animation but at the moment nothing happens when the brick is touched.
1 | function onTouched(hit) |
2 | local h = hit.Parent:findFirstChild( "Humanoid" ) |
3 | if h ~ = nil then |
4 | local anim = Instance.new( "Animation" ) |
5 | anim.AnimationId = "rbxassetid://29517689" |
6 | anim:Play() |
7 | end |
8 | end |
9 | script.Parent.Touched:connect(onTouched) |
You forgot to load your animation into the humanoid.
01 | function onTouched(hit) |
02 | local h = hit.Parent:findFirstChild( "Humanoid" ) |
03 | if h ~ = nil then |
04 | local anim = Instance.new( "Animation" ) |
05 | anim.AnimationId = "rbxassetid://29517689" |
06 | local animLoad = h:LoadAnimation(anim) -- An animation has to be loaded into the humanoid |
07 | animLoad:Play() |
08 | end |
09 | end |
10 | script.Parent.Touched:connect(onTouched) |