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

Make a block that appears when another block is pressed?

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?

2 comments

0

This site is for getting help with writing scripts, not requesting scripts.

0

elaborate on 'pressed'. Like clicked or touched?

1 answer

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:

BasePart.Touched

BasePart.Transparency

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