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

Why does this Textbox script not work properly?

Asked by 4 years ago
Edited by Leamir 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
local input = script.Parent.Input
local output = script.Parent.Output

if input.Text:lower() == "a" then
    output.Text = "v"
end

I am trying to type a in a textbox called Input and another textbox called Output to say another letter ( V )

2 answers

Log in to vote
0
Answered by 4 years ago

The script is only going to check once. You need to set up an event which will trigger whenever the player has something typed in the input. Try this:

local input = script.Parent.Input
local output = script.Parent.Output

input.FocusLost:Connect(function()
    if input.Text:lower() == "a" then
        output.Text = "v"
    end
end)
Ad
Log in to vote
-1
Answered by
Pupppy44 671 Moderation Voter
4 years ago
Edited 4 years ago

Use string.lower

local input = script.Parent:WaitForChild("Input")
local output = script.Parent:WaitForChild("Output")

function Changed()
if string.lower(input.Text) == "a" then 
output.Text = "v" 
end
end

input.Changed:Connect(Changed)
0
he is tho... raid6n 2196 — 4y
0
ok, i changed other stuff Pupppy44 671 — 4y

Answer this question