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

how can i make a part be pushed onto a button, to open a door?

i'm trying to create a puzzle for my roblox horror game, in this puzzle you need to push a block onto a button to activate a door. i'm an absolute noob at scripting so i have no clue what coding i would need for this! i've tried methods, but none of them have worked so far.

1 answer

✓ Accepted answer

Put this script in your button (remember to set the names where i tell you too):

local blockName = "name" --Replace the name part with whatever the name of the block you have to push is
local door = game.Workspace. --Write the rest of this directory to indicate the door
script.Parent.Touched:Connect(function(part)
	if part.Name == blockName then
		door.CanCollide = false
		door.Transparency = 1
	end
end)

Feel free to ask me to improve the terrible code that was written in 2 minutes or less idk lol

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