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

How do you make a door that when closed kills, but when opened allows you to pass?

Asked by 6 years ago

I'm trying to make a laser door, but I can't figure out how to. My script won't even open the door, and the door won't even kill you. So thanks if you can help.

local isOn = true
local Brick = script.Parent
local kill = true

function on()
 isOn = true
 script.Parent.Transparency = .8
 script.Parent.CanCollide = true
if kill == true then
    local function PlayerTouched(Part)
    local Parent = Part.Parent
    if game.Players:GetPlayerFromCharacter(Parent) then
        Parent.Humanoid.Health = 0
    end
end
end

function off()
 isOn = false
kill = false
if kill == false then
script.Parent.Transparency = 1
 script.Parent.CanCollide = false
end

function onClicked()

 if isOn == true then off() else on() end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

on()

Im a bit of a noob, so please go easy on me! :)

1 answer

Log in to vote
0
Answered by 6 years ago

There is a tutorial for a VIP door that may work without VIP. http://wiki.roblox.com/index.php?title=Restricted_door

0
It isn't a vip door... CaptainAlien132 225 — 6y
0
I know but if you copy certain scripts but ignore the scripts that say VIP you can make this door billybobRAE 41 — 6y
Ad

Answer this question