Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

3 comments

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)

0

Instead of firing a remote event, you can just create a billboard gui on the server.

0

He didn't ask for that.

This discussion is preserved as it was. New answers, comments, and votes are closed.