I am working on a game, and I wanted to make a block that appears when another block is pressed. Does anyone know a script I can use for this?
Since you provided a such roughly question, I will help the code while explaining to you.
1.Define two bricks.
local BrickDisappear = workspace.PartA local BrickTouch = workspace.PartB
The codes above defines two bricks.
2.Set up the signal(event) listener.
local Signal = nil Signal = BrickTouch.Touched:Connect(function() BrickDisappear.Transparency = 1 Signal:Disconnect() Signal = nil end)
Since the Touched
signal should only be listened once, we disconnect it after it fires.
3.Put all together.
local BrickDisappear = workspace.PartA local BrickTouch = workspace.PartB local Signal = nil Signal = BrickTouch.Touched:Connect(function(part) BrickDisappear.Transparency = 1 Signal:Disconnect() Signal = nil end)
Documentation: