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

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

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)

1 comment

0

remove line 6 and 8 and change game.StarterGui to game.Players.LocalPlayer.PlayerGui

2 answers

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

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