Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't this door let me put multiple ranks that walk through, and how do i do it?

Basically I had this script in a door and in that I had config, groupid, and rankid, its all right but I cant add multiple ranks at once, does anyone know how to fix this?

local config = script.Parent.Configuration

script.Parent.Touched:connect(function(part)
	if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
		local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
		if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
			script.Parent.CanCollide = false
			wait(0.3)
			script.Parent.CanCollide = true
		end
	end
end)

4 comments

0

So you basically want a Group rank door?

0

if yes then here.

0

tysm! this helped alot

0

wait its not workingf

1 answer

✓ Accepted answer

I have all of it explained out in the script its self!

					------------
					--SETTINGS--
					------------
--Current Group--
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. 
-----Group 1----
GroupId = 4802900 --Change this to GroupID of your group.
min = 10 --Change this to the minimum Group Rank Value of your group "GroupId" above (Rank 0-255) a Player can enter. NOTE: Replace with "-1" if you wish to disable this Rank Value.
max = 255 --Change this to the maximum Group Rank Value of your group "GroupId" above (Rank 0-255) a Player can enter. NOTE: Replace with "-1" if you wish to disable this Rank Value.
-----Group 2----
GroupId2 = -1 --Change this to GroupID of your group. NOTE: Replace with "-1" if you wish to disable this Group or do not wish to use it. 
min2 = -1 --Change this to the minimum Group Rank Value of your group "GroupId2" above (Rank 0-255) a Player can enter. NOTE: Replace with "-1" if you wish to disable this Rank Value.
max2 = -1 --Change this to the maximum Group Rank Value of your group "GroupId2" above (Rank 0-255) a Player can enter. NOTE: Replace with "-1" if you wish to disable this Rank Value.
-----Group 3----
GroupId3 = -1 --Change this to GroupID of your group. NOTE: Replace with "-1" if you wish to disable this Group or do not wish to use it.
min3 = -1 --Change this to the minimum Group Rank Value of your group "GroupId3" above (Rank 0-255) a Player can enter. NOTE: Replace with "-1" if you wish to disable this Rank Value.
max3 = -1 --Change this to the maximum Group Rank Value of your group "GroupId3" above (Rank 0-255) a Player can enter. NOTE: Replace with "-1" if you wish to disable this Rank Value.
Exceptions = {"Player1"} --[[Put names of Players that are exempted from the rank, group, and/or ItemID system. 
	This can be used to allow non-group members or anyone you want, clearance through the door. Put their names 
	in this format:{"Playername","Playername2"} NOTE: To disable remove the names from this list.--]]

--Item ID--
ItemIdenabled = false --Enable or Disable the Item ID feature. Set "true" to enable and "false" to disable. 
ItemId = 0 --The item/badge they can own in their inventory to allow passage through the door. Change it to the ItemID of the specific item/badge which is the Numbers at the end of the link to that Badge or Item.

--Specific Settings--
local KilluponTouched = true --If "true", kills non group members/incorrectly ranked members, if "false" does not let them in.
local WaitTime = 3 --Amount of time door remains open before closing.
DoorTransparency = 0 --Change this value to the Transparency you want the door to return to. (ex. 0=For Solid)
Door = script.Parent --Do not modify or remove.
Q = false --Do not modify or remove.
											 ----------
 											 --Script--
											 ----------
--Checks the Player Against Names in "Exceptions" List--
function CheckExceptions(name) 
for i = 1,#Exceptions do 
--Converts Strings to all Upper Case--
if (string.upper(name) == string.upper(Exceptions[i])) then return true end 
end return false end
 
--Makes Sure Player is Within Guidelines (Correct rank, group, possible exceptions, and/or they have the correct item within their inventory)--
--Group Check--
if GroupIdenabled == true then
function Touched(Part)
local Human = Part.Parent:findFirstChild("Humanoid")
if Q then return end
Q = true 
if Part.Parent then
p = game.Players:FindFirstChild(Part.Parent.Name)
if p then 
if p:GetRankInGroup(GroupId) >= min and p:GetRankInGroup(GroupId) <= max or p:GetRankInGroup(GroupId2) >= min2 and p:GetRankInGroup(GroupId2) <= max2 or p:GetRankInGroup(GroupId3) >= min3 and p:GetRankInGroup(GroupId3) <= max3 or (CheckExceptions(Human.Parent.Name))then
AccessGranted()
else
print("Nice Try, Skrub")
if KilluponTouched then Part.Parent:breakJoints()
	script.Parent.Denied:play()
end end end end  Q = false end end

--Item Check--
if ItemIdenabled == true then
function Touched(Part)
local Human = Part.Parent:findFirstChild("Humanoid")
if Q then return end
Q = true 
if Part.Parent then
p = game.Players:FindFirstChild(Part.Parent.Name)
if p then 
if game:getService"BadgeService":UserHasBadge(p.userId,ItemId)then
AccessGranted()
else
print("Own the Item to Gain Access")
if KilluponTouched then Part.Parent:breakJoints()
end end end end  Q = false end end

--Opens Door If Player's Rank was Correct--
function AccessGranted()
print("Access Granted")
Door.Transparency = 1
Door.CanCollide = false
script.Parent.Granted:play()
wait(WaitTime)
Door.CanCollide = true
Door.Transparency = DoorTransparency
end


Door.Touched:connect(Touched)

This discussion is preserved as it was. New answers, comments, and votes are closed.