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)))
end)


script.Parent.Touched:connect(function(hit)
	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
				wait(1)
				script.Parent.CanCollide = true
				script.Parent.Transparency = 0
				deb = false
			end
		else
			script.Parent.CanCollide = true
		end
	end
end)

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!!