Hello, i'm trying to implement a system where another client can send information to whatever other client that's in the game. And this seems to be not working.
There's 3 Scripts, Server, Local & ModuleScript.
The ModuleScript handles everything.
Here's the ModuleScript :
local module = {}
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local sendInformation = script.Parent.Parent.RemoteEvents.SendInformation
local sendToclient = sendInformation.Parent.SendToClient
module.ClientInt = function()
if RunService:IsClient() then
local player = Players.LocalPlayer
local inputPlayerName = player.PlayerGui.SendingOnClient.UI.InputPlayerName
local send = inputPlayerName.Parent.Send
send.MouseButton1Down:Connect(function()
local playerName = inputPlayerName.Text
sendInformation:FireServer(playerName)
end)
sendToclient.OnClientEvent:Connect(function(playerWhoSent)
inputPlayerName.Text = playerWhoSent.Name.." sent you this!"
end)
end
end
module.ServerInt = function()
if RunService:IsServer() then
sendInformation.OnServerEvent:Connect(function(playerWhoSent, playerWhoRecieves)
if Players:FindFirstChild(playerWhoRecieves) then
local playerInstance = Players:FindFirstChild(playerWhoRecieves)
sendToclient:FireClient(playerInstance, playerWhoSent)
else
print("That player isn't in the game!")
end
end)
end
end
return module

3 comments
did you require the module somewhere
Yes, i required the each function in both the Local script and the server script, i've tested this, everything works fine.
what do you mean by client?