Rank and above to change team

Try this:

LocalScript:

script.Parent.MouseButton1Click:Connect(function()
local event = -- whereever the event is in RS
event:FireServer()

end)

ServerScript:

local event = --same as the rs thing
game.Players.PlayerAdded:Connect(function(plr)

function Clicked()
if plr:GetRankInGroup(groupIDhere) >= rank then
plr.TeamColor = --teamcolor
event.OnServerEvent() 
        end
    end
end)

If this doesn’t work, DM me on Discord. Ey3r1s#6942

So this? I don’t have discord so I can’t dm you on it.

local event = --same as the rs thing
game.Players.PlayerAdded:Connect(function(plr)

	function Clicked()
		if plr:GetRankInGroup(5122099) >= 15 then
		plr.TeamColor = --Navy Blue 
			event.OnServerEvent() 
	end
	end
end)

idk what they were trying to do, but that doesnt work
cc @Ey3r1sAlpha

oh, my bad, it’s FindFirstAncestorOfClass, not GetFirstAncestorOfClass

Huh? A bit lost on what you mean.

erase: GetFirstAncestorOfClass and use FindFirstAncestorOfClass

Try this for the serverscript:


local event = --whereever the evnt is
	local function Clicked()
		if p:GetRankInGroup(9536284) >= 3 then
			p.TeamColor = BrickColor.new("Sea green")
			p:LoadCharacter()
		
		end
	end
	event.OnServerEvent:Connect(Clicked)
end)