Textbox local
local Player = game.Players.LocalPlayer
local Remote = script:WaitForChild("Event")
local Textbox = script.TextBox
Textbox.FocusLost:Connect(function()
Remote:FireServer(Textbox.Text)
end)
The script to publishasync
local Event = script.Parent.Event
local MessagingService = game:GetService("MessagingService")
Event.OnServerEvent:Connect(function(player, text)
MessagingService:PublishAsync("event", player.UserId, text)
end)
The messaging Service
local MessagingService = game:GetService("MessagingService")
local EventsFolder = game:GetService("ReplicatedStorage"):WaitForChild("RPFL")
local connection
function event(playerId, message)
local eventName = message["Data"]
local userName = playerId["Data"]
-- EventsFolder.MessagingClients:FireAllClients(event)
print(userName, eventName)
task.wait(1)
connection:Disconnect()
task.wait(10)
establishConnection()
end
function establishConnection()
connection = MessagingService:SubscribeAsync("event", event)
end
establishConnection()
This error started occuring with i added the playerId