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

Remote event not firing for some reason?

So I was making my own chat and bubble chat system and I tried to use remote event to fire when the player talks. However, the remote event did not fire and it didn't show anything on the server and client. I did try to search on how to fix it but none of these answers seemed to work for me. Feel free to ask any questions.

ServerScriptService script:

game.ReplicatedFirst.ChatMessage.OnServerEvent:Connect(function(p, msg)
	local ChatGUI = p.Character:WaitForChild("BubbleChatUI")
	spawn(function()
		while wait(1) do
			Timer = Timer - 1
			if Timer < 0  then
				Timer = 0
				ChatGUI.Enabled = false
			end
		end
	end)
	print("Chat message detected.")
	msg = game:GetService("Chat"):FilterStringForBroadcast(msg, p)
	ChatGUI.Enabled = true
	local val = Instance.new("StringValue", workspace.chatMessages)
	val.Name = p.Name
	val.Value = msg
	ChatGUI.MessageLabel.TextLabel.Text = msg
	Timer = 4
end)

TextBox localscript:

script.Parent.FocusLost:Connect(function(EnterPressed)
	if EnterPressed then
		game.ReplicatedFirst:WaitForChild("Events").ChatMessage:FireServer(script.Parent.Text)
		script.Parent.Text = ""
	end
end)

1 answer

✓ Accepted answer

Don't use ReplicatedFirst, put your remote event in ReplicatedStorage, and switch your code to define ReplicatedStorage instead of ReplicatedFirst and it will work, this is because ReplicatedStorage is used to communicate between client and server since it's on both

2 comments

0

Thank you! Works really well for me now.

0

np

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