Custom Admin Error

Hey, I am making custom admin commands and already made 3, TP, Kill, and FF. I keep getting an error.

Error: ServerScriptService.CustomAdmin:2: attempt to compare number <= string

When I remove >= 5 it works, so I don’t really understand.

Script:

	if player:GetRoleInGroup(11359577) >= 5 then
		player.Chatted:Connect(function(message)
			local split = message:split(" ")
			if split[1] == ":kill" then
				local name = split[2]
				local playerName = game.Players:FindFirstChild(name)
				
				if playerName then
					playerName.Character.Humanoid.Health = 0
				else
					warn(name.." Isn't in game!")
				end
			end
		end)
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRoleInGroup(11359577) >= 5 then
		player.Chatted:Connect(function(message)
			local split = message:split(" ")
			
			local name =  split[2]
			local playerName = game.Players:FindFirstChild(name)
			
			if split[1] == ":ff" then
				local ff = Instance.new("ForceField")
			
				if playerName then
				ff.Parent = playerName.Character
			else
				warn(name.."Isn't in game!")
				ff:Destroy()
			end
			elseif split[1] == ":unff" then
				if playerName then
					local ff = playerName.Character.ForceField
					
					if ff then
						ff:Destroy()
					else
						return error("No FF")
					end
				else
					warn("No Player")
				end
			end
		end)
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRoleInGroup(11359577) >= 5 then
		player.Chatted:Connect(function(message)
			local split = message:split(" ")

			local name =  split[2]
			local playerName = game.Players:FindFirstChild(name)

			if split[1] == ":tp" then
				local name = split[2]
				local playerName = game.Players:FindFirstChild(name)

				if playerName then
					player.Character.HumanoidRootPart.CFrame = playerName.Character.HumanoidRootPart.CFrame
				end
			end
		end)
	end
end)

The problem is that :GetRoleInGroup() fetches a player’s role name in a group as a string. Instead use :GetRankInGroup() which returns the rank as a number.

Changed it but now it doesn’t work and gives no errors. I need to go right now, will message soon.

When you get back, add print statements to your code to help debug the issue.

It’s because you’re using :GetRoleInGroup() instead of :GetRankInGroup()

Try adding a print() after the if statement with the :GetRankInGroup() function, to see whether or not it’s able to pass. Since if it’s not erroring it’s most likely because the data isn’t passing an if statement. You can check the Roblox API for an example and some extra explanation if I was unable to elucidate the :GetRankInGroup function. Though if you exactly changed :GetRoleInGroup to :GetRankInGroup I don’t think that is what’s causing the issue.

https://create.roblox.com/docs/reference/engine/classes/Player#GetRankInGroup