Team group rank Door

Yes, but only if those team names are similar to the ones in excludedRoles, otherwise you’ll have to make another table and check that one

local rank = 34 -- the rank the player will need to get through (out of 255)
local groupID = 0 -- The group ID the player must be in

local excludedRoles = {"Criminal","Civilian"} -- Add more
local excludedGroupRoles = {"Exiled"} -- Add more if needed

local deb = false

local function canUse(plr)
	return plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) >= rank and ((plr.Team and not table.find(excludedRoles, plr.Team.Name)) or not table.find(excludedGroupRoles,plr:GetRoleInGroup(groupID)))

	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if plr then
		if canUse(plr) then
			if not deb then
				deb = true
				script.Parent.CanCollide = false
				script.Parent.Transparency = .9
				script.Parent.CanCollide = true
				script.Parent.Transparency = 0
				deb = false
			script.Parent.CanCollide = true

I placed the checking code in that function since the if statement was getting a bit too long and unreadable, you may have to find a way to fix that up a bit if possible

I have no way to thank you! Very much!

1 Like

Anytime! That’s what me and others are here for, to help people like you with issues regarding scripting! If you have anymore issues don’t be afraid to make another post!!