Roblox how to make your game have New Game/Load game

Im making a game where it has missions

In-game (Lets say whenever a new mission is triggered (i use bindableevents) its like a checkpoint, so if the player would load the game he would exactly have that exact same event getting instantly triggered and spawn where he was left off)

In-menu (how could i make it so whenever the player pressed “load game” that data would load)

And the opposite for “new game”

2 Likes

use datastore to save and load the players last checkpoint

2 Likes

appreciate it but id like to someone who could be more detailed

1 Like
local db = game:GetService("DataStoreService"):GetDataStore("PlayerData")

-- load checkpoint
function load_Data(plr)
	local Key = "Plr_"..plr.UserId -- key to our data
	local Player_Data = db:GetAsync(Key) -- gets the saved data
	
	-- teleport the player to his checkpoint using "Player_Data" variable
	
	return
end

-- save checkpoint
function Save_Data(plr)
	local Key = "Plr_"..plr.UserId
	
	local Your_check_point_Data = nil
	
	db:SetAsync(Key,Your_check_point_Data)
end

thesse functions are far from perfect but should give you an idea of how it works

1 Like