How to send data cross server

^

local ProfileService = require(script:WaitForChild('ProfileService'))

local DATA_FOLDER = { --ALL OF THE THINGS THAT NEED TO UPDATE LIVE IN GAME.
	Catalog = {};
	M_Menu_Themes = {};
	TimeSync = {};
}

local GameProfileStore = ProfileService.GetProfileStore("Data4", DATA_FOLDER)
local profile = GameProfileStore:LoadProfileAsync(tostring("Test"))
if profile then
	profile:Reconcile()
		
	while true do 
		task.wait(10)
		print(profile:IsActive())
	end
	
	print(profile)
end
1 Like

You should use MessagingService or MemoryStoreService to send data cross server.

2 Likes

why not making Data Folder a module and require it?

1 Like

how to send this data across servers efficiently?

1 Like

U can use globaldatastore Or Emm… Idk Maybe Messaging Service

1 Like

k how? give me examples.

ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

sorry i no can give a example my roblox studio is crashing

https://developer.roblox.com/en-us/api-reference/class/MessagingService

1 Like

if U Want Send Data Cross Game U Can Use GlobalDataStores
Or U Want Send Data Cross Server U Can Use MessagingService

1 Like

how to send my data across servers efficiently?

1 Like
local MessagingService = game:GetService("MessagingService")
local Topic = "Example"
local DATA_FOLDER = { --ALL OF THE THINGS THAT NEED TO UPDATE LIVE IN GAME.
	Catalog = {};
	M_Menu_Themes = {};
	TimeSync = {};
}

-- start listening to the topic
MessagingService:SubscribeAsync(Topic, function(Data, Sent)
	print(Data)
end)

-- send a message to all subscribers of the topic
MessagingService:PublishAsync(Topic, DATA_FOLDER)
1 Like

Ok so that solves the problem of sending my information but what about my saved information? it was saved before

1 Like

u tried use parameters ?? u can add parameters

???

local ProfileService = require(script:WaitForChild('ProfileService'))
local MessagingService = game:GetService("MessagingService")

local DATA_FOLDER = { --ALL OF THE THINGS THAT NEED TO UPDATE LIVE IN GAME.
	Catalog = {};
	M_Menu_Themes = {};
	TimeSync = {};
}

MessagingService:SubscribeAsync("Example", function(Data, Sent)
	print(Data)
end)

local GameProfileStore = ProfileService.GetProfileStore("Data4", DATA_FOLDER)
local profile = GameProfileStore:LoadProfileAsync(tostring("Test"))
if profile then
	profile:Reconcile()
	
	profile:ListenToRelease(function()
		MessagingService:PublishAsync("Example", DATA_FOLDER)
		--???????
		--HOW TO PICK UP PROFILE AGAIN IN ANOTHER SERVERE AFTERE THIS SSERVER DROPS THIS PROFILLE?
	end)

	while true do 
		task.wait(10)
		print(profile:IsActive())
	end

	print(profile)
end

Will this not cause a chain reaction of messaging after each new server is created???

1 Like

still need help. -.-
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ

1 Like