This is a LocalScript which is inside of a TextButton.
01 | local playerGui = game.Players.LocalPlayer:WaitForChild( "PlayerGui" ) |
02 |
03 |
04 | local n = playerGui.OrderGui.Scroll.Name.TextBox.Text |
05 |
06 | function leftClick() |
07 | print ( "Left mouse click" ) |
08 | playerGui.OrderGui.CurrentOrder.Text = "Vanilla Milkshake by " ..n |
09 | end |
10 |
11 | script.Parent.MouseButton 1 Click:Connect(leftClick) |
When I remove the ..n part it works fine, but nothing happens when I click the button when it has the ..n part in it.
(Excuse me as I was tired when I wrote this, I can go into further detail if you ask)
Hello!
While I'm not 100% familiar with Lua textboxes, I believe I see your issue.
1 | local playerGui = game.Players.LocalPlayer:WaitForChild( "PlayerGui" ) |
2 |
3 | function leftClick() |
4 | local n = playerGui.OrderGui.Scroll.Name.TextBox.Text -- Move this inside the function so it gets updated to the textbox's current text. |
5 | print ( "Left mouse click" ) |
6 | playerGui.OrderGui.CurrentOrder.Text = "Vanilla Milkshake by " ..n |
7 | end |
8 |
9 | script.Parent.MouseButton 1 Click:Connect(leftClick) |
Because the TextBox was inside a frame called "Name," and "Name" is a property, that's what caused the issue.