Here is the localscript. This is for a chat inputbar that mimics ROBLOX's. However, remoteevents is not working!
It sends the inputbar's texts to server for processing but the server script prints it THREE times instead of ONCE!
Localscript:
local StarterGui = game:GetService("StarterGui");
local InputGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("Chat");
local InputFrame = InputGui.InputFrame;
local Input = InputFrame.Input;
local modules = game.Workspace["Module(s)"];
local chathandler = require(modules.ChatHandler);
local charLimit = 78;
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
local chatAdd = game.Workspace["Remote(s)"].chatAdd;
Input.FocusLost:connect(function(enterWasPressed) --//If enter key was pressed, thus submitting a chatmsg.
if enterWasPressed then
print("Executing enterWasPressed...");
if InputFrame.Visible == true then
chatAdd:FireServer(Input.Text); --//Problem occurs HERE!
Input.Text = ("");
InputFrame.Size = UDim2.new(0.22,0,0.038,0);
end
end
end)
Server script:
--//Varuabkes:
local remotes = game.Workspace["Remote(s)"];
local chatMessages = serverData.chatMessages;
local chatAdd = remotes.chatAdd;
--//
chatAdd.OnServerEvent:connect(function(player,msg)
print("Executing server event...");
print(msg);
end)
Should be easy as one-two-three. Why isn't it working!? Help.
Image of the chat inputbar:
Output:
**Local output:**
Executing enterWasPressed...
**Server output:**
Executing server event...
Unprecedented!
Unprecedented!
nil

2 comments
Just a side note: you should just use wait() if you plan on having the least delay with the function. No matter what interval you pass to wait, it's not going to go below (approximately) 1/30th of a second.
Same problem is occurring. Not fixed. Help?