How send data to other place

Hello,

How to send data, e.g. tables with players, to another place
game1

-- server script

function StartGame()
local table = {napastnikiek1, roblox, hotdog}

Safetp(placeid, table, #table)
end

game2

-- server script

print(game1 data)

I want the data to be available to the server, not to the player

Another server or another place within the experience? Just to clarify

This can be achieved through using the MessagingService. The Services’ :SubscribeAsync() function will allow for cross experience communication! However, this cannot be done with places that do not exist within the same universe.

I hope you find this helpful!

yes, I am trying to send the number of players so that the game cannot start without all the players

Hello! Seems like you are wanting to send data along when you are teleporting a player :smiley:

I don’t know how your Safetp method works, but generally you can use TeleportOptions to fill in whatever data you wish:

-- Server
function SendParty()
	local ListOfPlayers = {}
	
	local Options = Instance.new("TeleportOptions")
	Options:SetTeleportData({
		PlayerCount = #ListOfPlayers,
		-- Whatever else
	})	
	
	TeleportService:TeleportAsync(placeId, ListOfPlayers, Options)
end

And on the other place you can receive player data like this:

game.Players.PlayerAdded:Connect(function(Player: Player)
	local AllData = Player:GetJoinData()
	local TeleportData = AllData.TeleportData
	-- TeleportData.PlayerCount
end)

You can read more about it in this article. Hope this helps :smiley: If you have any more questions let me know!

2 Likes

everything works as it should, tnx :happy1:

1 Like

No problem! Glad I was able to help and good luck on your game! :smiley:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.