Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my script not able to compare group ranks?

local groupId = 5144614

function added(player)
local ls = Instance.new("IntValue")
ls.Name = "leaderstats"

local infoplr = Instance.new("IntValue")
infoplr.Name = "importantplr"

--leaderstats
local role = Instance.new("StringValue")
role.Name = "Rank"
--end of line

--Console statistics
local hours = Instance.new("IntValue")
hours.Name = "Hours"
local ma = Instance.new("BoolValue")
ma.Name = "MachineAccess"
ma.Value = false
local Admin = Instance.new("BoolValue")
Admin.Name = "Admin"
--end of line

role.Value = player:GetRoleInGroup(groupId)

ls.Parent = player
role.Parent = ls
infoplr.Parent = player
--proo34 statistics
hours.Parent = infoplr
ma.Parent = infoplr
Admin.Parent = infoplr
	

	if player:GetRoleInGroup(groupId) >= 16 then
	--right here ^^
		game.Players.LocalPlayer:WaitForChild("importantplr")
		game.Players.LocalPlayer.importantplr:WaitForChild("Admin")
		Admin.Value = true
	else
		Admin.Value = false
	end
--end of line

end
game.Players.PlayerAdded:connect(added)

This script decides if the player should have a boolean called admin true or false, as well as other ranks, but the admin only should work for people over a certain rank which is 16. Can figure out why it errors out. Thanks for the help!

2 comments

0

its :GetRankInGroup

0

:GetRoleInGroup will return the string value of the players role..such as "Owner" or "Guest"

1 answer

✓ Accepted answer

It appears you're using Player:GetRoleInGroup(), which returns the rank name. You want to use Player:GetRankInGroup().

This discussion is preserved as it was. New answers, comments, and votes are closed.