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

Why won't a TextBox Text edit with a Script?

Asked by 10 years ago

I am making a ROBLOX Game, and when I type this word out exactly, the text will not change.

if script.Parent.Text == "Where am I?" then script.Parent.Text = "You are in ROBLOX"
    wait(1)
end

1 answer

Log in to vote
0
Answered by
AxeOfMen 434 Moderation Voter
10 years ago

You need to place your code in an event handler for the Changed event of the TextBox:

In a Localscript that is a child to the TextBox:

local textbox = script.Parent
textbox.Changed:connect(function(property)
    if property == "Text" and textbox.Text == "Where am I?" then
        textbox.Text = "You are in ROBLOX"
    end
end)
Ad

Answer this question