BenjaminPlays

Group Door Script - ROBLOX

Dec 4th, 2020 (edited)
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. CurrentGroup = 8434242 -- Change this to GroupID of your group
  2. DOORNAME = script.Parent -- Do not modify
  3. IsActive = false -- Do not modify
  4. KillOnContact = false -- If true, kills non group members, if false does not let them in.
  5. WaitTime = 1 -- Amount of time door remains open
  6. G1 = script.Parent.Parent.Green1
  7. G2 = script.Parent.Parent.Green2
  8. R1 = script.Parent.Parent.Red1
  9. R2 = script.Parent.Parent.Red2
  10.  
  11.  
  12. function Touched(Part)
  13. if IsActive then return end
  14. IsActive = true
  15. if Part.Parent then
  16. Player = game.Players:playerFromCharacter(Part.Parent)
  17. if Player then
  18. if Player:IsInGroup(CurrentGroup) then
  19. Open()
  20. else
  21. print("Atleast it exists?")
  22. R1.BrickColor = BrickColor.new("Really red")
  23. R2.BrickColor = BrickColor.new("Really red")
  24. if KillOnContact then Part.Parent:breakJoints()
  25. wait(WaitTime)
  26. R1.BrickColor = BrickColor.new("Black")
  27. R2.BrickColor = BrickColor.new("Black")
  28. end
  29. end
  30. end
  31. end
  32. IsActive = false
  33. end
  34.  
  35. function Open()
  36.  
  37. G1.BrickColor = BrickColor.new("Lime green")
  38. G2.BrickColor = BrickColor.new("Lime green")
  39. Door.Transparency = 1
  40. Door.CanCollide = false
  41. wait(WaitTime)
  42. G1.BrickColor = BrickColor.new("Black")
  43. G2.BrickColor = BrickColor.new("Black")
  44. Door.CanCollide = true
  45. Door.Transparency = 0
  46.  
  47. end
  48.  
  49. Door.Touched:connect(Touched)
  50.  
Add Comment
Please, Sign In to add comment