in this game i'm working on, two players need to step on 2 seperate buttons (in two seperate areas) for a door to open. but i'm not really sure how i would script it, how can i make this?
COMMUNITY QUESTION
how can i make it so two players have to step on pads for a door to open roblox?
1 answer
Keep in mind, this isn't a very reliable script but it does the job.
Make something in workspace exactly like https://drive.google.com/file/d/1hZB3MWzrGj3DWiRoGtpwS5ThGR2rEzOV (Model name and Door name doesn't matter)
--Part1 and Part2 script
local isUse = script.Parent.inUse
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
isUse.Value = true
print("Enter")
script.Parent.BrickColor = BrickColor.new("Bright green")
end
end)
script.Parent.TouchEnded:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
isUse.Value = false
print("Left")
script.Parent.BrickColor = BrickColor.new("Really red")
end
end)
--Door script
while wait() do
if script.Parent.Parent.Part1.inUse.Value == true and script.Parent.Parent.Part2.inUse.Value == true then
script.Parent.CanCollide = false
script.Parent.Transparency = 0.75
else
script.Parent.CanCollide = true
script.Parent.Transparency = 0
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
the pads change color but the door isnt opening for me!