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

how can i make it so two players have to step on pads for a door to open roblox?

Asked by
omorizz 50
2 years ago

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?

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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
0
the pads change color but the door isnt opening for me! omorizz 50 — 2y
Ad

Answer this question