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

Why wont my Chatbox work?

Asked by
sigve10 94
9 years ago

I have been making a new chat interface, but for some reason it all falls apart when I test it with more players:

script.Parent.Focused:connect(function()
    if script.Parent.Text == "Press T, /, or click here to chat" then
        script.Parent.Text = ""
    end
end)
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
end)
function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Slash or inputObject.KeyCode == Enum.KeyCode.T then
        script.Parent:CaptureFocus()
    end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

There are NO output errors, so please dont ask

0
I haven't tried anything yet as I have no idea what is causing the error sigve10 94 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Make sure you check for GameProcessedEvent, so that you're not stealing input from blocking actions. Also, what is script.Parent.Parent.Value.Value? It doesn't appear to link out to anything, so chances are each Player is managing to somehow change the same thing all the time, and/or the problem is outside of your given script.

0
thank you... I changed the script into checking the key from the mouse, then it worked... now the only problem is that it wont clear the textbox, nor send the message... sigve10 94 — 9y
Ad

Answer this question