I would like to make a brick that gets removed when I touch a different brick, but I can't figure out how I can do that.
Example: We have two bricks, A and B.
When I touch A, B will get removed and won't come back.
I hope that this is all the information you need, and if not then make sure to ask and I'll try to respond as quickly as possible, any help is appreciated!
my good sir the script that we talked about
Script:
local BrickB = workspace.BrickB local debounce = false --added debounce so it doesnt freak out and run at 1 thousand horses a square liter script.Parent.Touched:Connect(function(hit) -- hit defines the part that touched it if game.Players:FindFirstChild(hit.Parent.Name) then -- do hit.Parent because the part of the player that touched it is inside a model if debounce == false then debounce = true -- make sure script cant run more than once at a time local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- find teh player from the part that touched the brick wait(3) BrickB:Destroy() -- send it to the shadow realm debounce = false -- give the go ahead for the script to run again(its gonna be deleted anyway but good practice) end end end)
Hey there! I hope i can help you!
You should use :Destroy()
to remove the bricks.
Example Script(Server Script inside a part in the workspace):
local part = workspace.B script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then part:Destroy() else print("The part is not a character") end end)