sending script (place1):
local msgService = game:GetService("MessagingService")
game.Players.PlayerAdded:Connect(function(plr)
local data = {
plr.Name,
plr.AccountAge,
{
"M16",
"1911",
"Combat Knife"
}
}
local pubSuccess,pubResult = pcall(function()
local msg = data
msgService:PublishAsync("PlayerData",msg)
end)
if not pubSuccess then
print(pubResult)
end
end)
receiving script (place2):
local MSG_TOPIC = "PlayerData"
local msgService = game:GetService("MessagingService")
print("variables started")
game.Players.PlayerAdded:Connect(function(plr)
print(plr.Name.." joined")
local subSuccess,subConnection = pcall(function()
return msgService:SubscribeAsync(MSG_TOPIC,function(message)
print(message.Data)
end)
end)
if subSuccess then
plr.AncestryChanged:Connect(function()
subConnection:Disconnect()
end)
end
end)
for some reason it prints the player joined and the variables but not the data itself, did i do something wrong?