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

How do you use a remote event to make a Rank GUI work?

Asked by 5 years ago

The rank GUI is on a Local Script and is in Starter GUI.

It has a billboard GUI, a frame with 3 text boxes in it.

local epicPeople = {"mrhaphap402"}

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:GetRankInGroup(3345195) >= -255
     then
        return true
    end
    return false
end 

local ids = {1,1}
local teams = {""}
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(3345195) 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(3345195)
        local groups = {3965252, 4038679}
        for i=1, #groups do
            local role = player:GetRoleInGroup(groups[i])
            if role ~= "Regimental Recruit" 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 5 years ago

I don't recommend using RemoteEvents for this. Do it all ServerSided. If you use a LocalScript, you might run into issues where people can't see specific things. DM me on Discord and I can give you a rank gui you can take a look on how I did it.

game.Players.PlayerAdded:Connect(function(player) -- Sets the value of player to the player that joined.

Bark#4260

Ad

Answer this question