Group Roles Not Working Properly

I don’t know if it’s me or not but the group roles won’t work for me. It used to but not anymore.

Group Role 255 = Owner
Group Role 2 = Real Supporter
Group Role 1 = Normal Supporter

local Type = ""

if game.Players.LocalPlayer:GetRankInGroup(9146155) == 2 then
Type = “2”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
elseif game.Players.LocalPlayer:GetRankInGroup(9146155) == 1 then
Type = “1”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
elseif game.Players.LocalPlayer:GetRankInGroup(9146155) == 255 then
Type = “Owner”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
else
Type = “Default”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
end
game.Players.LocalPlayer.Character.Humanoid.Changed:Connect(function()
if game.Players.LocalPlayer.Character.Humanoid.Health <= 0 then
wait(0.5)
local Type = “”
if game.Players.LocalPlayer:GetRankInGroup(9146155) == 2 then
Type = “2”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
elseif game.Players.LocalPlayer:GetRankInGroup(9146155) == 1 then
Type = “1”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
elseif game.Players.LocalPlayer:GetRankInGroup(9146155) == 255 then
Type = “Owner”
game.ReplicatedStorage.OnGroupPerks:FireServer(Type)
end
end
end)

The group role ID is correct too. I checked it and even pasted it.

Have you considered using a table for all of this? I also don’t understand what you’re trying to do.

1 Like

No, should I use tables? Im not getting any errors with this at all.

So, if the player is a type 1, then a remote event starts, and they are a default, type 2, supporter, type 255 is owner.

What is the RemoteEvent supposed to do? Have you considered just doing :GetRoleInGroup()?

1 Like

No, I didn’t know there was a :GetRoleInGroup() let me try that then. And this is for nametags.

If you’re doing rank nametags just use :GetRoleInGroup() as it will return something like “Member,” and you should probably just use game.Players.PlayerAdded because exploiters could spam the RemoteEvent to cause lag.

Edit: Here’s the developer hub article about it Player | Roblox Creator Documentation

1 Like

About exploiters, I have anti exploit for flying, speedrunning, and also script removing. What else can I do to protect my game?

Oh, and good job on your crown of o’s! Does it have to be like total players playing in a day or total players a month? My game got 109 players this month in development phase.

Alright, it’s doing the same thing sadly.