Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont my Chatbox work?

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

1 comment

0

I haven't tried anything yet as I have no idea what is causing the error

1 answer

✓ Accepted answer

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.

1 comment

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...

This discussion is preserved as it was. New answers, comments, and votes are closed.