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

How would I make a text different based on group rank?

Asked by 3 years ago

Hi everyone, I would like to ask for some help. I have a textbox, and I want to change it accordingly to your group rank, I want it to be client sided, so I need to use a LocalScript. But I can't get it to work! Any help would be appreciated! Here is my current script:

local Frame = game.Workspace.CONTROLS.SurfaceGui.Frame
local Scrolling = game.Workspace.CONTROLS.SurfaceGui.ScrollingFrame

game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(5907099) >= 254 then
        Frame.Visible = false
        Scrolling.Visible =  true
        else
        Frame.Visible = true
        Scrolling.Visible = false
    end
end)

Thank you again, any help is appreciated!

1 answer

Log in to vote
0
Answered by
rabbi99 714 Moderation Voter
3 years ago

This would be your serverscript:

rp = game:GetService("ReplicatedStorage")
playergroup = rp:WaitForChild("PlayerGroup") -- Make a remoteevent called PlayerGroup that's located in ReplicatedStorage


game.Players.PlayerAdded:Connect(function(plr)
    local rank = plr:GetRoleInGroup(5907099)
    print(plr, "is", rank) -- This is useful for testing
    playergroup:FireAllClients(plr, rank)
end)

and this your localscript:

local textlabel = script.Parent-- Specify where it is located. I recommend putting this localscript under the textlabel
local rp = game:GetService("ReplicatedStorage")
local playergroup = rp:WaitForChild("PlayerGroup")
player = game.Players.LocalPlayer

local Frame = game.Workspace.CONTROLS.SurfaceGui.Frame
local Scrolling = game.Workspace.CONTROLS.SurfaceGui.ScrollingFrame

playergroup.OnClientEvent:connect(function(plr, rank)
    if plr ~= nil and plr.Name == player.Name and player:GetRankInGroup(5907099) >= 254 then
        textlabel.Text = rank
        textlabel.Visible = true
    end
end)
0
ScreenGuis are on the client, while Surface Guis and Billboard Guis are actually on the server (so people can see it in the workspace) IceyTazeForLife 253 — 3y
0
Instead of firing a remote event, you can just create a billboard gui on the server. IceyTazeForLife 253 — 3y
0
He didn't ask for that. rabbi99 714 — 3y
Ad

Answer this question