Edit: I realized that when I click the enter button, both of the functions fire. Any suggestions on how to fix this problem?

Something is wrong with one of these scripts (Guessing the second one)

I am making a chatbox, that only allows text that isn't "Chat here!" The error is, when I make text on the first box, and then I do another one for the second box, the first box gets the same text of the second box, but the 2nd box gets the same text, too.

So, how will I fix it so the text of the 2nd box isn't like the first box?

BOX #1:

box = script.Parent.Parent.ChatBox

script.Parent.MouseButton1Click:connect(function()
	if box.Text ~= "Chat here!" then
		script.Parent.Parent.C1.Text = script.Parent.Parent.Parent.Parent.Name..": "..box.Text
	end
end)

BOX #2:

box = script.Parent.Parent.ChatBox
script.Parent.MouseButton1Click:connect(function()
	if box.Text ~= "Chat here!" and script.Parent.Parent.C1.Text ~= "" then
		script.Parent.Parent.C2.Text = script.Parent.Parent.Parent.Parent.Name..": "..box.Text
	end
end)

4 comments

0

I believe it should be "==" instead of "~="

0

"~=" means not equivalent to.

0

i know :/

0

i dont want ==, i meant to use ~= :/