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

A problem regarding GUI text buttons?

Hello there!

I was thinking of making a register GUI. I was expecting to make a "Login" button and the display button, where it would display the username of the local player.

This is how I started;

script.Parent.Username.TextLabel.Text = "Loading"

This is what I want, before pressing the login button. So to continue;

game.Players.LocalPlayer.PlayerGui.ScreenGui.Login.TextButton.MouseButton1Down:Connect()

game.Players.LocalPlayer.PlayerGui.ScreenGui.Username.TextLabel.Text = "Logged by " .. game.Players.LocalPlayer.Name

So this is where I got confused, It is correct that the script ignores the first line and goes with the third one. I couldn't create a relationship between the "function" and the output. So, my login text button wouldn't execute the function.

I would also like to know the difference between MouseButtonDown and Click.

I'm really sorry if you found this annoying. This is the only hope where I could get a valid reply.

Thank you for reading this.

1 answer

✓ Accepted answer

Hello, SW33TSTUFF !

yes, it is normal to ignore...

You have to call a function on the clicked event:

game.Players.LocalPlayer.PlayerGui.ScreenGui.Login.TextButton.MouseButton1Down:Connect(function()

game.Players.LocalPlayer.PlayerGui.ScreenGui.Username.TextLabel.Text = "Logged by " .. game.Players.LocalPlayer.Name

end)

This will work now

Good Luck with your games

4 comments

0

Oh, wasn't thinking about that. Really found something new. :thumbs_up:

0

Scripting aways makes me discover new things....

0

Just wanted to know, if this is the same with the SurfaceGUI or a new function should be made with the Mouse...?

0

Yes, it is the same, just don't forget to add the function() to the event

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