Module Script, located in Workspace
local module = {}
function module.ReceiveChat(Message, Sender)
return Message, Sender
end
function module.SendChat(Message, Sender)
if Message ~= nil and Message ~= "Click here or press '/' to chat!" then
module.ReceiveChat(Message, Sender)
end
end
return module
Server Script, located in StarterGui under a GUI
local module = require(game.Workspace.ModuleScript) --486793676
local player = script.Parent.Parent.Parent
local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
if key:byte() == 13 then
if script.Parent.EnterText ~= "Click here or press '/' to chat!" and script.Parent.EnterText ~= "" and script.Parent.EnterText ~= nil then
module:SendChat(script.Parent.EnterText.Text, player.Name)
end
end
end)
game:GetService("UserInputService").InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.Slash then
script.Parent.EnterText:CaptureFocus()
elseif key.KeyCode == Enum.KeyCode.BackSlash then
module.ReceiveChat:connect(function(Message, Sender) --Error right here
print(Message .. ", " .. Sender)
end)
end
end)
It sends the chat through, but whenever I try to get it back, it gives me this error: "attempt to index field 'ReceiveChat' (a function value)"
I really don't know how to make it so I can get the values back. Help is very appreciated, thanks!
