Can't set TextLabel to a role in group

After following the Rank centre tutorial and getting it all working I decided that rather than have the double click button at the bottom I want it instead to display something like “You rank in group is: groupRank”. I created an event in ReplicatedStorage named “ChangeGui” and a LocalScript here:
image

This is what is in that script:
image

(I know that it looks completely different to the tutorial but I was adding new bits which are working.)

I also added a script in ServerScriptService:
image

When I run the game I get this error:

I have two questions:

  1. How can I fix this error and make it update?
  2. How can I get the variable playerRole outside the function and hence be able to display it onto the TextLabel?

Any help would be great!

Thanks,
Kermit.

The error your getting means that it that “TextLabel” is not inside of “ScreenGui”,

The issue is, your already inside of “TextLabel”, as you define it on the first line with a variable.

local PlayerGui = script.Parent

Moving on, we don’t exactly need the “gui” parameter of our remote event.

So, let’s make everything hardcoded, except the text for our textlabel.

ChangeGui.OnClientEvent:Connect(function(text)
        PlayerGui.Text =  text
end)

(PlayerGui is the Parent of the LocalScript your inside

Server:

changeGui:FireAllClients("Hello World!")

If you want to read up more on how to use Instance.Parent, read this short topic on the debhub.


Remember if it worked to mark my post as solution! :white_check_mark:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.