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

Help needed on script for Textbox. Script should make other GUI things disappear. Anyone help?

Asked by 6 years ago

Hello, as you may as guessed I need help with a script. It should make other stuff disappear when a player types in "war" in it. Please help!

Here is the script I've done. (its not working.)

if script.Parent.Text == "war" or "War" then
    script.Parent.Visible = false
    script.Parent.Parent.replyinform.Visible = false
    script.Parent.Parent.ctc.Visible = true
    script.Parent.Parent.replyingtext1.Visible = true

end

Thanks!

2 answers

Log in to vote
0
Answered by 6 years ago

Here is the correct script. Your error is on line 1. You're saying if the text box's text is equal to "war" or just randomly say "War". Lua does not interpret it like that. You must repeat what you said. If this is not explained well, I'll explain in the script. Make sure it's Local

script.Parent.Changed:Connect(function(prop) -- every time the textbox changes. 
    if script.Parent.Text == "War" or script.Parent.Text == "war" then -- this is what i meant by how lua interprets things. you have to specify what the "or" is. what your current script says is, if the text is equal to war, or just an unspecified string is there. like what does "war" alone mean? the program doesn't know. 
        -- Do code.
    end
end)
0
Thanks! It works! STRONGMINECRAFT7 4 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

I'll just replace your script here.

script.Parent:GetPropertyChangedAsync("Text"):Connect(function()
    if script.Parent.Text == "war" or "War" then
        script.Parent.Visible = false
        script.Parent.Parent.replyinform.Visible = false
        script.Parent.Parent.ctc.Visible = true
        script.Parent.Parent.replyingtext1.Visible = true
    end
end)
0
Make sure it's a localscript. MachoPiggies 526 — 6y
0
It's wrong. User#19524 175 — 6y

Answer this question