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

Make The Frame Not visible if the letter in box is S?

Asked by 5 years ago

hello this script dont works can you fix it?: and can i get information a little bit Thanks.

wait()
repeat
    wait(1)
    if script.Parent.Name == "S" then
        script.Parent.Visible = false
    end
until false
wait()

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Problem

your checking the name if the TextBox is S not the text property of it. Also you can just use the FocusLost event instead of a infinite loop to reduce latency. string.match() is what your looking for to check if theres a certain character or word inside a string.

--local script, also no need to add wait()

TextBox.FocusLost:Connect(function(EnterKeyLostFocus) -- define "TextBox"
    if EnterKeyLostFocus == true then 
        local lower = string.lower(script.Parent.Text) -- turns all letters in the string to lowercase
        if string.match(lower,"s") then
            Frame.Visible = false -- define "Frame"
        end
    end 
end)

FocusLost fires when the client stops focusing on the textbox, or you could say when the client stops typing in the textbox. I used string.lower since there could be uppercase or lowercase letters. The enterPressed parameter or what I named EnterKeyLostFocus is a boolean if the client pressed the enter key while typing.

0
You could use GetPropertyChangedSignal("Text") aswell depending on if you need to check for the S whenever it's there or when they finish typing it Amiaa16 3227 — 5y
0
yeah, i was actually gonna use that, but then then i realized it fires when your tying. so i used FocusLost instead User#23365 30 — 5y
0
i think thats what he wanted User#23365 30 — 5y
0
this is a test User#19524 175 — 5y
0
wydm\ User#23365 30 — 5y
Ad

Answer this question