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

How do I destroy blocks made from a script by hitting them?

I made the Brick here:

while true do
	wait(1)
WP = Instance.new("Part", game.Workspace)
WP.Position = Vector3.new(math.random(100), math.random(100), math.random(100))
end

It creates the bricks falling from the sky like it's supposed to, but how do I add a collision event to each one of the bricks that spawn saying if I touch them, they will be removed?

1 answer


function wahtever(touched) -- if you want it to be destroyed when it touches baseplate WP.Name = "hello" while true do wait(1) WP:Remove() end end game.Workspace.hello.Touched:connect(wahtever)

-- I'm not sure if its going to work, Give it a try but I haven't scritped for a long time. 
-- If it doesen't work try changing workspace.hello to Workspace.WP

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