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

Making a door with proximityprompt that requires to have a keycard in the inventory. ?

Asked by 1 year ago

Hello everyone, I'm trying to make a door with a proximityprompt that basically requires you to have a keycard in your inventory or else it won't open. I tried to script it but basically it doesn't even open if you have a keycard. Anyone help?

local Door = script.Parent.Parent

script.Parent.ProximityPrompt.Triggered:Connect(function(Player)
    if Player:WaitForChild("Backpack"):FindFirstChild("Access Card") or Player.Character:FindFirstChild("Access Card") then

        script.Parent.ProximityPrompt.Enabled = false

        Door.Door.CanCollide = false
        Door.Door.Transparency = 0.7
        Door.DiamondPlate1.CanCollide = false
        Door.DiamondPlate1.Transparency = 0.7
        Door.DiamondPlate2.CanCollide = false
        Door.DiamondPlate2.Transparency = 0.7
        Door.DiamondPlate3.CanCollide = false
        Door.DiamondPlate3.Transparency = 0.7
        Door.DiamondPlate4.CanCollide = false
        Door.DiamondPlate4.Transparency = 0.7
        Door.DiamondPlate5.CanCollide = false
        Door.DiamondPlate5.Transparency = 0.7
        Door.DiamondPlate6.CanCollide = false
        Door.DiamondPlate6.Transparency = 0.7
        Door.DiamondPlate7.CanCollide = false
        Door.DiamondPlate7.Transparency = 0.7
        Door.DiamondPlate8.CanCollide = false
        Door.DiamondPlate8.Transparency = 0.7
        Door.DiamondPlate9.CanCollide = false
        Door.DiamondPlate9.Transparency = 0.7
        Door.DiamondPlate10.CanCollide = false
        Door.DiamondPlate10.Transparency = 0.7
        Door.DiamondPlate11.CanCollide = false
        Door.DiamondPlate11.Transparency = 0.7
        Door.DiamondPlate12.CanCollide = false
        Door.DiamondPlate12.Transparency = 0.7
        Door.DiamondPlate13.CanCollide = false
        Door.DiamondPlate13.Transparency = 0.7
        Door.DiamondPlate14.CanCollide = false
        Door.DiamondPlate14.Transparency = 0.7
        Door.DiamondPlate15.CanCollide = false
        Door.DiamondPlate15.Transparency = 0.7
        Door.DiamondPlate16.CanCollide = false
        Door.DiamondPlate16.Transparency = 0.7
        Door.Window.CanCollide = false
        Door.Window.Transparency = 0.7

        wait(5)

        Door.Door.CanCollide = true
        Door.Door.Transparency = 0
        Door.DiamondPlate1.CanCollide = true
        Door.DiamondPlate1.Transparency = 0
        Door.DiamondPlate2.CanCollide = true
        Door.DiamondPlate2.Transparency = 0
        Door.DiamondPlate3.CanCollide = true
        Door.DiamondPlate3.Transparency = 0
        Door.DiamondPlate4.CanCollide = true
        Door.DiamondPlate4.Transparency = 0
        Door.DiamondPlate5.CanCollide = true
        Door.DiamondPlate5.Transparency = 0
        Door.DiamondPlate6.CanCollide = true
        Door.DiamondPlate6.Transparency = 0
        Door.DiamondPlate7.CanCollide = true
        Door.DiamondPlate7.Transparency = 0
        Door.DiamondPlate8.CanCollide = true
        Door.DiamondPlate8.Transparency = 0
        Door.DiamondPlate9.CanCollide = true
        Door.DiamondPlate9.Transparency = 0
        Door.DiamondPlate10.CanCollide = true
        Door.DiamondPlate10.Transparency = 0
        Door.DiamondPlate11.CanCollide = true
        Door.DiamondPlate11.Transparency = 0
        Door.DiamondPlate12.CanCollide = true
        Door.DiamondPlate12.Transparency = 0
        Door.DiamondPlate13.CanCollide = true
        Door.DiamondPlate13.Transparency = 0
        Door.DiamondPlate14.CanCollide = true
        Door.DiamondPlate14.Transparency = 0
        Door.DiamondPlate15.CanCollide = true
        Door.DiamondPlate15.Transparency = 0
        Door.DiamondPlate16.CanCollide = true
        Door.DiamondPlate16.Transparency = 0
        Door.Window.CanCollide = true
        Door.Window.Transparency = 0.4

        script.Parent.ProximityPrompt.Enabled = true
    end
end)
0
What is shown in the console? BoiBoi24T 63 — 1y

Answer this question