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