Profile Service Question

Currently what I am trying to do is save information into the game/server. However I am unsure of how I can make this work correctly.

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()
	
	profile:ListenToRelease(function()
		print("ok")
	end)
	print(profile)
end

Whenever I test the code above and join 2 servers at the same time, profileService will ‘Release()’ automatically and pass over to the newest server. Is that ok?

I’ve already watched that tutorial. It’s not that helpful for what I am trying to achieve. I tested my code and it printed “ok” without me using “Release()” so I am just wondering why tho?

So I should just forceload each time a new server is ran? Also this data will not be used for any players. It will be used for data in the server. Each new server will hold the latest profile if loaded and if I want to update anything from older servers, I’ll have check if the profile is active and reload it, then save it again?

That is the intended behavior. One of the reasons ProfileService is so popular is because one of the features of ProfileService is the fact that if someone joins 2 servers, it will lock one of them and pass the data to the newest server.

If you wouldn’t like that behavior, there is ways to change it, otherwise, just use normal DataStoreService. :slightly_smiling_face:

So what is the best way/method to saving data onto the server with profile service?

The method you’re already using. If it works for you, that is what matters. I can’t specify one specific method, because there are so many different reasons to why you use different functions of ProfileService. Just find which one works for you! Play around with it, and you’ll eventually find one that works the way you want and gives you the result intended!

ok i join the server then make a new server and the profile is released. now i change something in the servers inventory and want to update it. How to do that if its released. Just load it again? will this not cause a chain reaction?..

still makes 0 sense bruh. wtf -.-