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

TextBox's text doesnt show when clicking a button. Help?

Asked by 5 years ago
Edited 5 years ago

Hey y'all. Im bad at scripting and im trying to do so when you say something in the TextBox and click on a button. It shows it on a TextLabel. But this script doesnt work. Helping could be nice. Thanks!

local text = game.StarterGui.ScreenGui.Frame.TextBox
local button = script.Parent
local label = game.StarterGui.ScreenGui.Frame.TextLabel

script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.MouseButton1Click then
        label.Text = text.Text
    end
end)

(Also for questions this is a localscript in the textbutton)

0
remove line 6 and 8 and change game.StarterGui to game.Players.LocalPlayer.PlayerGui Gameplayer365247v2 1055 — 5y

2 answers

Log in to vote
0
Answered by
Alphexus 498 Moderation Voter
5 years ago

remove the if statement on line 6.

Ad
Log in to vote
0
Answered by
TopBagon 109
5 years ago
Edited 5 years ago

There's nothing wrong with the if statement, you can keep it if you want... the problem is in your variables, you can't use that path, instead, you should use a script.Parent...and so on Here's an example

local text = script.Parent.Parent.Frame.TextBox -- Check if correct
local button = script.Parent
local label = script.Parent.Parent.Frame.TextLabel -- Check if correct

button.MouseButton1Click:Connect(function()
    if script.Parent.MouseButton1Click then
        label.Text = text.Text
    end
end)

Make sure to correct path if it's not right

Hope this helped

Answer this question