Trouble with team-changer

Hi, all! I’m trying to build a restricted team where you have to be in the group, but it isn’t working. Here is my script:

local Players = game:GetService("Players")
local team = game.Teams["TEAM RED"]

local player = Players.LocalPlayer

local gid = script.Parent.SETTINGS.groupID
local minrnk = script.Parent.SETTINGS.minRank


script.Parent.MouseButton1Click:Connect(function()
	if player:GetRoleInGroup(gid) >= minrnk then
		game.ReplicatedStorage.Change:FireServer(team)
	end
end)

Help and support would be greatly appreciated! I’ve asked everywhere and couldn’t find an answer.

1 Like

You should be using :GetRankInGroup not :GetRoleInGroup

You should also be verifying the information is accurate on the server not client. If i was exploiting I could just fire your event and get teamed to whatever I want, that is if your only checking on client.

It worked, thanks! I know that it has to be :GetRankInGroup, but I just didn’t remember. :GetRoleInGroup returns as string value (e.g. “Owner”).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.