Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CurrentGroup = 8434242 -- Change this to GroupID of your group
- DOORNAME = script.Parent -- Do not modify
- IsActive = false -- Do not modify
- KillOnContact = false -- If true, kills non group members, if false does not let them in.
- WaitTime = 1 -- Amount of time door remains open
- G1 = script.Parent.Parent.Green1
- G2 = script.Parent.Parent.Green2
- R1 = script.Parent.Parent.Red1
- R2 = script.Parent.Parent.Red2
- function Touched(Part)
- if IsActive then return end
- IsActive = true
- if Part.Parent then
- Player = game.Players:playerFromCharacter(Part.Parent)
- if Player then
- if Player:IsInGroup(CurrentGroup) then
- Open()
- else
- print("Atleast it exists?")
- R1.BrickColor = BrickColor.new("Really red")
- R2.BrickColor = BrickColor.new("Really red")
- if KillOnContact then Part.Parent:breakJoints()
- wait(WaitTime)
- R1.BrickColor = BrickColor.new("Black")
- R2.BrickColor = BrickColor.new("Black")
- end
- end
- end
- end
- IsActive = false
- end
- function Open()
- G1.BrickColor = BrickColor.new("Lime green")
- G2.BrickColor = BrickColor.new("Lime green")
- Door.Transparency = 1
- Door.CanCollide = false
- wait(WaitTime)
- G1.BrickColor = BrickColor.new("Black")
- G2.BrickColor = BrickColor.new("Black")
- Door.CanCollide = true
- Door.Transparency = 0
- end
- Door.Touched:connect(Touched)
Add Comment
Please, Sign In to add comment