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

How do I make a group only door?

Asked by 11 years ago

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.

3 answers

Log in to vote
0
Answered by 11 years ago

You would do so like this:

01local door = script.Parent -- Change me to where the door is
02local groupId = 0 -- The digits at the end of the URL for your group
03 
04door.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
14end)
Ad
Log in to vote
0
Answered by
Kozero 120
11 years ago

I wanted to make it an anonymous function to make the code slightly shorter.Make sure the script is in the door.

01GroupID = 12345 --Change this to your groups ID
02Door = script.Parent
03Kill = true --if you want them to die if there in the group set it to true otherwise to false
04 
05Deb = false
06script.Parent.Touched:connect(function(p)
07if p.Parent:FindFirstChild("Humanoid") then
08player = game.Players:GetPlayerFromCharacter(p.Parent)
09if player then
10if not Deb then
11Deb = true
12if player:IsInGroup(GroupID) then
13Door.Transparency = 0.5
14Door.CanCollide = false
15wait(0.2)
View all 28 lines...
0
00:55:11.894 - Error in script: unexpected symbol near '01' Alyssall 0 — 11y
Log in to vote
-2
Answered by 11 years ago
01                                        -- Group Rank Based Door Script V1.4 --
02                                              -- By: DeathPossession --
03                    ------------
04                    --SETTINGS--
05                    ------------
06--Current Group--
07GroupIdenabled = true--Enable or Disable the group and rank check feature, as well as Exceptions settings below. Set "true" to enable and "false" to disable.
08GroupId = 1080850 --Change this to GroupID of your group.
09min = 10
10max = 255 --Change this to the maximum Group Rank Value (Rank 0-255) a Player can enter.
11Exceptions = {"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--
View all 85 lines...

Answer this question