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

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

Asked by
omorizz 50
2 years ago

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

Log in to vote
0
Answered by 2 years ago

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

Ad

Answer this question