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

Why wont it work? Focuslost

Asked by
sigve10 94
8 years ago

I have been making a chat gui, but my chatbox wont react when it loses focus. It works as it should if I play solo, but upon starting a server/going online it wont work and there is no error outputs:

script.Parent.FocusLost:connect(function(EnterPressed)
    if EnterPressed and script.Parent.Text ~= "" then
        script.Parent.Parent.Value.Value = script.Parent.Text
        script.Parent.Text = "Press T, /, or click here to chat"
    end
    if script.Parent.Text == "" then
        script.Parent.Text = "Press T, /, or click here to chat"
    end
end)

Anyone who can help?

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

Instead of 2 if statements, use an elseif statement. Remove the end on line 5, and replace 'if' on line 6 with 'elseif'

0
Not quite what I was looking for... I now know that that is possible, but that is not what I wanted to know. sigve10 94 — 8y
Ad

Answer this question