What do you want to achieve? Keep it simple and clear!
I want to make a texbox prompt thing where if you put a text to a textbox it will change a textlabel text
What is the issue? Include screenshots / videos if possible!
when i apply the text it didnt change anything or print anything.
Video:
Code:
local textbox = script.Parent.TextBox
local initiateCode = script.Parent.InitiateCode
if textbox.Text == “Remove” then
initiateCode.Text == “[0],[0],[0]”
print(“Removed”)
end
So far I can see, you have the correct paths to the text, and the code thinks the same.
However, your code keeps going, reaches the if statement and checks if it’s true. At that point (milliseconds into the game) the textbox is probably " ", so the if statement is ignored and the code keeps going.
You have to trigger an event to run the if statement. You could probably use the UserInputService to check if the player presses the Enter button. Once pressed (the event) will connect to a function that will run this code:
Ur script checks one time when game run, this script run when Text changes
local initiateCode = script.Parent.InitiateCode
local textbox = script.Parent.Parent.TextBox
textbox:GetPropertyChangedSignal("Text"):Connect(function()
if textbox.Text == "Remove" then
initiateCode.Text = "[0],[0],[0]"
print("Removed")
end
end)