How to save ALL progress in game?

Hello everyone! I tried to make save progress system like in simulators with ChatGPT but he is write me so messy code

this is ChatGPT script:

– Save and Load Place Script

– Function to save the current place to a specified slot
local function savePlace(slot)
– Ensure the slot is a valid number
if type(slot) ~= “number” then
warn(“Invalid slot number”)
return
end

local success, errorMessage = pcall(function()
	game:SavePlace(slot)
end)

if success then
	print("Place saved successfully to slot " .. slot)
else
	warn("Error saving place to slot " .. slot .. ": " .. errorMessage)
end

end

– Function to load a place using a given place ID
local function loadPlace(placeId)
– Ensure the placeId is a valid number
if type(placeId) ~= “number” then
warn(“Invalid place ID”)
return
end

local success, errorMessage = pcall(function()
	game:LoadPlace(placeId)
end)

if success then
	print("Place loaded successfully with ID " .. placeId)
else
	warn("Error loading place with ID " .. placeId .. ": " .. errorMessage)
end

end

– Example usage of savePlace and loadPlace functions
– Saving the current place to slot 1
savePlace(1)

– Loading a place with a specific place ID (replace with actual place ID)
loadPlace(17667643886)

– Uncomment the following lines to test the functions with different slots and place IDs
– savePlace(2)
– loadPlace(987654321)

I new at scripting, this because i dont know how to do this

ChatGPT is giving you wrong/invalid information.

You need to learn the basics first; you can’t jump into this without understanding how to write or understand code.

1 Like

opakfopampkfplakogpkp[oaskdgop

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.