How to Display Points Earned On Screen

  1. I want to display points on screen momentarily as they are awarded to a player.

  2. I have a module script (in ServerStorage) that handles awarding points when a player passes through a points part. Wanted to display the points as a text label in StarterGui, but of course, the module script (server), can’t control the GUI (local).

  3. Was trying to set the GUI’s enable or visible to “true”, i.e. game.StarterGui.pointsLabel.Visible = true, but of course, this won’t work. I have searched but didn’t find this issue in the Dev Forum.

It doesn’t make sense in this case to put a local script in this StarterGui, because I can’t see any way it can listen for the event that should trigger points, which is the player passing through a points part. This event, in turn, fires a function in a PointsController module script, which triggers a sound FX, gets players current points, checks for 2X or 4X game passes, and triggers a ParticleEmitter. Would like this script to then include showing the points on screen, but as stated above, we have the issue of a server script not being able to talk to a local script.

Thanks in advance for any ideas.

3 Likes

You can grab the PlayerGui using Player.PlayerGui which will handle your third method. StarterGui doesn’t change what the players will see at the moment, it will just change how the GUIs are when the player spawns (and will affect all players).

You could also just fire a RemoteEvent with the points after you’ve done all those checks and have a local script listen to it.

That is what remote events are for

1 Like

Hi,
How would I get the “Player”? when I just put Player.PlayerGui , it does not work.

I thought you already detect the player? If you aren’t, how are checking who is touching the part?

How is the server handling the points? Does it use a table or does it insert an intvalue into the player.

You can do for server gives points to some player and then local script in gui always checking value in him local player and changing text in this gui element

Thanks! This worked exactly as expected. When we fire the PointsController, we just added “player” as an argument, then within that:

player.PlayerGui.ShowPoints.Enabled = true
player.PlayerGui.ShowPoints.TextLabel.Text = PointsEarned
wait(1.5)
player.PlayerGui.ShowPoints.Enabled = false

R.

1 Like