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

LocalPlayer names aren't displaying?

Asked by 5 years ago

Hello there, I'm quite new to this field. I was thinking of creating a register with a Surface GUI. My attempt is to display the the local player's username when the "login" button is clicked. This is how I completed;

script.Parent.Frame1.Username.Text = ("Username:" .. game.Players.LocalPlayer.Name)
script.Parent.Frame2.LoginButton.MouseButton1Click:connect(function()
    print(game.Players.LocalPlayer.Name)
    end)

Username = The text label for Frame1. My expected output.

LoginButton = A text button for login.

Sadly, my expected output isn't printed in Frame1,

Is there something wrong with the concatenation and string?

Thank you.

0
Is this a local script? Where is this script placed? RAYAN1565 691 — 5y
0
Debug your script with print function. At the top add a print, to make sure the script is actually running. Make sure it's not disabled and that it's a LocalScript. User#19524 175 — 5y
0
This is in a local script. SW33TSTUFF 7 — 5y
0
Is it disabled? User#19524 175 — 5y
0
It's active, I think something is wrong with the Text button or Mouse connect. I'll update soon by changing the frames. SW33TSTUFF 7 — 5y

1 answer

Log in to vote
0
Answered by
herrtt 387 Moderation Voter
5 years ago

Why do you have Text = ("")?

script.Parent.Frame1.Username.Text = "Username: " .. game.Players.LocalPlayer.Name

script.Parent.Frame2.LoginButton.MouseButton1Click:Connect(function()
    print(game.Players.LocalPlayer.Name)
end)
0
("") works too and it makes the code look cleaner. uhTeddy 101 — 5y
0
But they're irrelevant, and an overuse of () make code illegible. They're not invisible. User#19524 175 — 5y
Ad

Answer this question