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

How to set the text on a textlabel as a group role in a group?

Asked by 4 years ago

I'm trying to make a little panel that shows, your name, your picture, and your rank, but I can't get it to change. This is the script that I have but it won't work.

game.Players.PlayerAdded:Connect(function(player)

script.Parent.Text = player:GetRoleInGroup(--group ID)

I have this in a LocalScript inside of the text label.

1 answer

Log in to vote
0
Answered by 4 years ago

The PlayerAdded event can only be detected on the server, whereas you're using a local script which is run on the client. Since local scripts only run while the player is in the game, you don't need an event that waits for the player to join the game. You can edit your script to look like this:

local player = game:GetService("Players").LocalPlayer
script.Parent.Text = player:GetRoleInGroup(--Group ID)

If you have any questions or problems with this answer, let me know. I'd be happy to clarify or fix it.

Hope this helps!

0
Great job, thank you so much! co_existance 141 — 4y
0
Happy to help MegaManSam1 207 — 4y
Ad

Answer this question