Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make my game progress save automaticly?

Asked by
DashDQ 17
4 years ago
Edited 4 years ago

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?

1
You can save when the player leaves using the 'PlayerRemoving' event avengerstar 74 — 4y
0
Have any idea where can i learn to script that? DashDQ 17 — 4y
0
yes nothesducks 15 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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
0
Where do i put this script? In the leaderstats script made by me? DashDQ 17 — 4y
0
THE one wher stands put in leaderstats must be put in leaderstats nothesducks 15 — 4y
0
The other one not and yes put in your own leaderstats nothesducks 15 — 4y
Ad

Answer this question