I have a value stored in replicatedstore, how do I save it to database so when I rejoin, the number stays there and doesn't reset??
Use DataStore Service.
I'll show you a little example of it using a number value(you can change the number value with any number value in the game, it could be a number that is in the leaderstats folder, if you have one).
local saveData = game:GetService('DataStoreService'):GetDataStore('NumberSaver') local number -- type here the location of the number value. local plrs = game:GetService('Players') plrs.PlayerAdded:Connect(function(plr) local newNumber local s, e = pcall(function() newNumber = saveData:GetAsync(plr.UserId) -- gets number from id end) if s then if newNumber == nil then number.Value = 0 -- put here the number that you want when there is a new player in the game. else -- if the player already joined the experiece before, it will give the number value the same value that it had before number.Value = newNumber end else warn(e) -- if there is a error, it will send it to the output end end) -- when the player joins the server, the data store will get the number in the user id of that player and put it in number.Value. plrs.PlayerRemoving:Connect(function(plr) local s, e = pcall(function() saveData:SetAsync(plr.UserId, number) end) if not s then warn(e) -- if there is a error, it will send it to the output end end) -- when the player leaves the server, the data store will save the number in the user id of that player.
This will change the value of 'number' when player joins and leaves.