The first script says that when someone steps on a brick called Button, another brick called Door will become transparent and walkthrough. The second one says that when someone clicks a part called Button, the part called Door will open. Will these work? [EDITED BY DUMMIEZ]
First script (Button Touch Door)
local debounce = true function onTouch(Button) if debounce and Button.Parent:FindFirstChild("Humanoid") and Button.Parent.Name == game.Players:findFirstChild(Button.Parent.Name) then debounce = false game.Workspace.Door.Transparency = 0.5 game.Workspace.Door.CanCollide = false wait(5) game.Workspace.Door.Transparency = 0 game.Workspace.Door.CanCollide = true debounce = true end end script.Parent.Touched:connect(onTouch)
Second script (Button Click Door)
H = game.Workspace.Door local debounce = true function onTouch(Button) if debounce and Button.Parent:FindFirstChild("Humanoid") and Button.Parent.Name == game.Players:findFirstChild(Button.Parent.Name) then debounce = false function onClick(Button) H.Transparency = 0.5 H.CanCollide = false wait(5) H.Transparency = 0 H.CanCollide = true end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
These should work fine, however some improvements in the first script with Touched events, is that if you want only players or humanoids to active the door is to check if parent contains a Humanoid or search for the name on thegame.Players
First script:
local debounce = true function onTouch(Button) if debounce and Button.Parent:FindFirstChild("Humanoid") and Button.Parent.Name == game.Players:findFirstChild(Button.Parent.Name) then debounce = false game.Workspace.Door.Transparency = 0.5 game.Workspace.Door.CanCollide = false wait(5) game.Workspace.Door.Transparency = 0 game.Workspace.Door.CanCollide = true debounce = true end end script.Parent.Touched:connect(onTouch)
You can do the debounce with the second door as well.