Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

LocalPlayer names aren't displaying?

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.

5 comments

0

Is this a local script? Where is this script placed?

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.

0

This is in a local script.

0

Is it disabled?

0

It's active, I think something is wrong with the Text button or Mouse connect. I'll update soon by changing the frames.

1 answer

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)

2 comments

0

("") works too and it makes the code look cleaner.

0

But they're irrelevant, and an overuse of () make code illegible. They're not invisible.

This discussion is preserved as it was. New answers, comments, and votes are closed.