Localscript(Placed in StarterPlayerScripts)

local rs = game:GetService("ReplicatedStorage")
local ranking = rs:WaitForChild("Ranking")
local plr = game.Players.LocalPlayer
plr.CharacterAdded:Connect(function(char)
ranking:FireServer()
print("Fired")

end)

Script (Placed in ServerScriptService

local rs = game:GetService("ReplicatedStorage")
local ranking = rs:WaitForChild("Ranking")
wait(1)
ranking.OnServerEvent:connect(function(player)

if not player then
warn("an error occured fetching the player")
end
wait(1)
local groupService = game:GetService('GroupService')
local groups = groupService:GetGroupsAsync(player.UserId)
    local ui = script.Rank:Clone()
    ui.Parent = player.Character
    ui.Adornee = player.Character.Head
    
while not player.Character.Humanoid do wait() end
    player.Character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
    local frame = ui.Frame
    local name = frame.Main
    local title = frame.Title
for _,groupInfo in pairs(groups) do
    if groupInfo.Id == 4489568 then
if groupInfo.Role == ranks[1] or groupInfo.Role == ranks[2] or groupInfo.Role == ranks[3]or groupInfo.Role == ranks[4] or groupInfo.Role == ranks[5] or groupInfo.Role == ranks[6] or groupInfo.Role == ranks[7] or groupInfo.Role == ranks[8] or groupInfo.Role == ranks[9]or groupInfo.Role == ranks[10] or groupInfo.Role == ranks[11] or  groupInfo.Role == ranks[12] or groupInfo.Role == ranks[13] or groupInfo.Role == ranks[14]or groupInfo.Role == ranks[15]or groupInfo.Role == ranks[16]or groupInfo.Role == ranks[17]or groupInfo.Role == ranks[18]or groupInfo.Role == ranks[19] then
        name.Text = player.Name.. ", "..groupInfo.Role
else
        name.Text = player.Name..", ".."Guest"
end
end
end)

ModuleScript(Child of the Script)

local ranks = {"President", 
"Assistant Manager", 
"Vice President", 
"Corporate Officer",
"General Manager", 
"Supervisor", 
"Intern", 
"Head Team Member",
"Professional Team Member",
"Senior Team Member",
"Team Member",
"Junior Team Member",
"Trainee",
"Business Partner",
"Former Executive",
"Gold Customer",
"Premium Customer",
"Customer"}
return ranks

The gui doesn't show up above the players head, there are no errors in the output and the remote has fired correctly.

2 comments

0

could you change the or's to elseif and then paste code in between? Example if ranks[1] == ranks[2] then --code elseif

0

It turned out to be the studio's problem, thank you anyways.