Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i make my game progress save automaticly?

If i made a simulator game where you gain points.What if for one player lost all his progress on the game made by me is gone?Is there a script because i don t want to make a button to save progress on the game.That would be weird.

Can someone help me?

3 comments

1

You can save when the player leaves using the 'PlayerRemoving' event

0

Have any idea where can i learn to script that?

0

yes

1 answer

✓ Accepted answer

what you have to do is first you have to make a variable called datastore like this

--save script

local datastore = game:GetService("DataStoreService"):GetDataStore("yeet")

game.Players.PlayerRemoving:Connect(function(leaver)
	datastore:SetAsync("player_"..leaver.userId,enter here your'e value)
end)

-- load script put in leaderstats

local key = "player_"..ThatOne.UserId -- gets UserId
	
local getsave = datastore:getAsync(key)
	your value here.Value = getsave 
this is the script

3 comments

0

Where do i put this script? In the leaderstats script made by me?

0

THE one wher stands put in leaderstats must be put in leaderstats

0

The other one not and yes put in your own leaderstats

This discussion is preserved as it was. New answers, comments, and votes are closed.