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

A problem regarding GUI text buttons?

Asked by 5 years ago

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

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
5 years ago

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

0
Oh, wasn't thinking about that. Really found something new. :thumbs_up: SW33TSTUFF 7 — 5y
0
Scripting aways makes me discover new things.... Leamir 3138 — 5y
0
Just wanted to know, if this is the same with the SurfaceGUI or a new function should be made with the Mouse...? SW33TSTUFF 7 — 5y
0
Yes, it is the same, just don't forget to add the function() to the event Leamir 3138 — 5y
Ad

Answer this question