How do I make a group only door? I know how to link a game to a group but I don't know how to make doors where only certain ranks can go inside.
Example: A founder room. Only the founder can enter.
You would do so like this:
01 | local door = script.Parent -- Change me to where the door is |
02 | local groupId = 0 -- The digits at the end of the URL for your group |
03 |
04 | door.Touched:connect( function (hit) -- When the door is touched |
05 | if (hit and hit.Parent and hit.Parent:FindFirstChild( "Humanoid" ) and game.Players:FindFirstChild(hit.Parent.Name)) then |
06 | if (game.Players [ hit.Parent.Name ] :IsInGroup(groupId)) then |
07 | door.CanCollide = false |
08 | wait( 1 ) |
09 | door.CanCollide = true |
10 | else |
11 | hit.Parent.Humanoid.Health = 0 -- Kill them if they're not in the group |
12 | end |
13 | end |
14 | end ) |
I wanted to make it an anonymous function to make the code slightly shorter.Make sure the script is in the door.
01 | GroupID = 12345 --Change this to your groups ID |
02 | Door = script.Parent |
03 | Kill = true --if you want them to die if there in the group set it to true otherwise to false |
04 |
05 | Deb = false |
06 | script.Parent.Touched:connect( function (p) |
07 | if p.Parent:FindFirstChild( "Humanoid" ) then |
08 | player = game.Players:GetPlayerFromCharacter(p.Parent) |
09 | if player then |
10 | if not Deb then |
11 | Deb = true |
12 | if player:IsInGroup(GroupID) then |
13 | Door.Transparency = 0.5 |
14 | Door.CanCollide = false |
15 | wait( 0.2 ) |
01 | -- Group Rank Based Door Script V1.4 -- |
02 | -- By: DeathPossession -- |
03 | ------------ |
04 | --SETTINGS-- |
05 | ------------ |
06 | --Current Group-- |
07 | GroupIdenabled = true --Enable or Disable the group and rank check feature, as well as Exceptions settings below. Set "true" to enable and "false" to disable. |
08 | GroupId = 1080850 --Change this to GroupID of your group. |
09 | min = 10 |
10 | max = 255 --Change this to the maximum Group Rank Value (Rank 0-255) a Player can enter. |
11 | Exceptions = { "Yournamehere" } --[[Put names of Players that are exempted from the rank, group, and/or ItemID system. |
12 | This can be used to allow non-group members or anyone you want, clearance through the door. Put their names |
13 | in this format:{"Playername","Playername2"} NOTE: To disable remove the names from this list.--]] |
14 |
15 | --Item ID-- |