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

I am trying to make the gui display the players name but the script doesnt work. any help?

Asked by 4 years ago

Here is the script:

local player = script.Parent.Parent.Parent.Parent.Parent.Players.LocalPlayer

script.Parent.Text = player

end of script.

so basically the script picks the player that is in the server and then the script tells the text to change to that players name. but it doesn't work. let me know if you know the answer.

0
Players = game:GetService("Players") plyr = Players.LocalPlayer x28_97 -9 — 4y
0
Do you want the text to be the players name? bolterazia -5 — 4y

4 answers

Log in to vote
1
Answered by 4 years ago

Hi RealJustFoxin!

To do this, you need to get the name of the player.

Something like this will do:

local player = game.Players.LocalPlayer

script.Parent.Text = player.Name
0
Thanks for accepting! LennyPlayzYT 269 — 4y
Ad
Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
4 years ago

You haven't set the name, you just wrote player, you must write player.Name also i reccomend using game.Players.LocalPlayer instead.

Log in to vote
0
Answered by 4 years ago

Hello!

This is how I would go about fixing this:

local player = game.Players.LocalPlayer

player.PlayerGui.ScreenGui.TextLabel.Text = player.Name --Change this line (before the =) to match with your gui.

Make sure this is in a localscript and you're good to go! :)

Log in to vote
-1
Answered by 4 years ago

I have An Explanation Please Accept

script.Parent.Text = game:GetService("Players").LocalPlayer.Name

Easy As This :) Hope This Works

Answer this question