Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my script not able to compare group ranks?

Asked by
proo34 41
4 years ago
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!

0
its :GetRankInGroup ForeverBrown 356 — 4y
0
:GetRoleInGroup will return the string value of the players role..such as "Owner" or "Guest" ForeverBrown 356 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question