How would I send data between two places?

I have two places, one is a sub-place of the other (I don’t know the actual term). I want to send data between them, but I don’t know how.

I have tried MessagingService, I might be doing it wrong so heres my current code

Place1 (Main place that recieves data)

function PlayerAdded(player)
		local MsgName = player.UserId.."_TixEarned"

MsgService:SubscribeAsync(MsgName,function(Data)
		print(Data)
	end)
end

Place2 (Sub-place that sends data to place 1)

Players.PlayerRemoving:Connect(function(plr)
	local v = plr:WaitForChild("CurTixEarned")
	if v then
		local amount = v.Value
		local usid = plr.UserId
		
		print(usid,amount)
		
		MsgService:PublishAsync(usid.."_TixEarned",amount)
	end
end)

My current issue is that Place1 is not recieving the data

If you want to save data to persist across all places, you can use DataStores. DataStores can save access the same data no matter which place you’re in.

You can do this for the amount of player a tix earned in your game.

This worked, thank you so much!

1 Like