Hello. I added lines to the script, so instead of letting players pass doors who are from my group, instread it lets door be passed by specific ranks on my group, so i changed the script a bit, but now the doors are not working at all!
CurrentGroup = 2684229 -- Change this to GroupID of your group Door = 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 = 2 -- 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 if Player:GetRankInGroup(CurrentGroup) == 255 if Player:GetRankInGroup(CurrentGroup) == 254 if Player:GetRankInGroup(CurrentGroup) == 80 end end 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)
GetRankInGroup can and sometimes is sketchy to be used. I consider using GetRoleInGroup instead. It is basically the same except instead of returning the RankId of the player, it returns the role name.
So lets say for instance ( this is just an example script ), you have a group with the ID of 2525294. In that group with said ID you have a rank called "MLG"
Here is how it would check if the player is in that group ( place script in a wall part )
script.Parent.Touched:connect(function(hit) if game.Players:FindFirstChild(hit.Parent.Name) then local player = game.Players:FindFirstChild(hit.Parent.Name) print("is a player") if player:IsInGroup(2525294) then print("player is in group") if player:GetRoleInGroup(2525294) == "MLG" then print("player is in group and the role of him/her is MLG") script.Parent.CanCollide = false wait(2) script.Parent.CanCollide = true end end end end)
Hope this helped!