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

How do you remove a brick when hit?

Asked by 9 years ago

Hi guys! I'm making a Bowling game, and I'm wondering how do you remove the pins when it falls down to the ground? I have this script where it says when it hits, it removes, but it doesn't when I go into Test Mode! Please help! I also have a Regen Button attached to it so I don't know what else to do.

if script.Parent.Name == "Pin" then
function onTouched(hit)
    if hit.Parent.Parent.Name == "Pin" then
        hit.Parent.Parent:Remove()
    end
end

script.Parent.Touched:connect(onTouched)

function go()
wait(0.01)

script.Parent:remove()

end

end

script.Parent.Activated:connect(go)
0
block code plz Tesouro 407 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

If you want to get a brick to be removed when touched then do this:

function onTouch()

script.Parent:remove()

end
game.Workspace.Player.Touched:connect(onTouched)

Its kind of the same with a gun's bullet, just with some tweaking.

0
Thank you so much! LukeGabrieI 73 — 9y
Ad

Answer this question