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

How do I make this Rank GUI show for everyone, not just the player?

Asked by 5 years ago

This Rank GUI only shows for the player, not for everyone to see others. Players can only see their Rank GUI, not other peoples.

local epicPeople = {""}

local swagOn = false

function findEpicPeople(person)
    for i,v in pairs(epicPeople) do
        if v == person then
            return true
        end
    end
    return false
end

function assesIfCan(plr)
    if findEpicPeople(plr.Name) == true or plr:GetRankInGroups(4186798) >= 0-255
     then
        return true
    end
    return false
end 

local ids = {1,1}
local teams = {"Team1"}
local terrorists = {} 

function checkTeam(player1)
    local team = nil
    local tc = nil
    for o,b in pairs(game.Teams:GetChildren()) do
        if b.TeamColor == player1.TeamColor then
            tc = b.Name
        end
    end
    for i,v in pairs(teams) do
        if v == tc then
            team = i
        end
    end
    local group = ids[team]
    return group
end

local player = game.Players.LocalPlayer
function assessRank()
    if game.Players.LocalPlayer:IsInGroup(4186798, 3728461) or not game:FindFirstChild("NetworkServer") then
        repeat wait() until game.Workspace:FindFirstChild(player.Name)
        repeat wait() until player.Character:FindFirstChild("Head")
        if player.Character:FindFirstChild("Rank") then
            player.Character.Rank:remove()
        end
        a = script.Rank:clone()
        a.Parent = player.Character
        a.Adornee = player.Character.Head
        a.Frame.TextLabel.Text = player:GetRoleInGroup(4186798)
        local groups = {4186863, 4299061, 4166199, 3828960, 4010414, 3728461, 3658297, 3372423, 3064151}
        for i=1, #groups do
            local role = player:GetRoleInGroup(groups[i])
            if role ~= "Guest" then
                a.Frame.Regiment.Text = role
            end
        end
        a.Frame.Name1.Text = player.Name
        a.Frame.Name1.TextColor = player.TeamColor
        a.Frame.Regiment.TextColor = player.TeamColor
            a.Frame.Name1.TextStrokeTransparency = 0
        end
        if checkTeam(player) then
        a.Frame.TextLabel.Text = player:GetRoleInGroup(checkTeam(player))
        a.Frame.Regiment.Text = player:GetRoleInGroup(checkTeam(player))
        end

        repeat wait() until player.Character:FindFirstChild("Humanoid")
        player.Character.Humanoid.NameOcclusion = "OccludeAll"
        if player.Character:FindFirstChild("Body Colors") then
        if player.TeamColor == BrickColor.new("Medium stone grey") or player.TeamColor == BrickColor.new("White") then
            player.Character["Body Colors"]:remove()

        end
    end
end

assessRank()

game.Players.LocalPlayer.Changed:connect(function (prop)
    if prop == "TeamColor" then
        assessRank()
    end
end)

1 answer

Log in to vote
0
Answered by
Stedaa 30
5 years ago

Well your doing this in a localscript, Localscript only make changes for the local player, With that said there are multiple ways you could do it, You could have the serverscript handle the leaderboard and send the values to the localscript to make the changes for you, An alternative to this would be remote functions but I don't know if you'd want to do that. If you want it to update on all game servers you may need to use a datastore aswell!

0
Could I change the local script into a normal script, would that work? GamingRedhart -20 — 5y
0
No that would not work, The localscript and server sided scripts are 2 different things handling different events, I would recommend this video to get you started, https://www.youtube.com/watch?v=4pc3XJRL00o It's a little old and bad quality but it explains it pretty well! Hope I helped. Stedaa 30 — 5y
Ad

Answer this question