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

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

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

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
Ad

Answer this question