Jump to content

Recommended Posts

I've think you've seen from the esctemplate that it has a onsave and onload function:
these functions save and load data so that the data stays after leaving and rejoining.

you'll need to save the data first which should start by creating the variable to be saved but instead of local you should save it to the player so

inst.variable_name = 0 -- or nil
--above inst.onsave cus it needs to be created before being called

than simply have 
inst.variable_name = data given
to add to the data being save

local function OnSave (inst, data) --inst is you the object, and data is data :]
    data.variable_name = inst.variable_name
    --saving the data you have to the data to be saved
end
local function onload(inst, data) --loading the data you saved
    if data ~= nil and data.variable_name ~= nil then --checking the data is saved/there
        inst.varaible_name = data.variable_name --re-introducing the data which was saved
    end
end

 

btdubs if the esctemplate doesn't already have a save function simpy put
 

--inst.vairable_name = 0--data
inst.OnSave = function_name

 

Edited by Thomas Die
17 hours ago, Thomas Die said:

I've think you've seen from the esctemplate that it has a onsave and onload function:
these functions save and load data so that the data stays after leaving and rejoining.

you'll need to save the data first which should start by creating the variable to be saved but instead of local you should save it to the player so


inst.variable_name = 0 -- or nil
--above inst.onsave cus it needs to be created before being called

than simply have 
inst.variable_name = data given
to add to the data being save


local function OnSave (inst, data) --inst is you the object, and data is data :]
    data.variable_name = inst.variable_name
    --saving the data you have to the data to be saved
end

local function onload(inst, data) --loading the data you saved
    if data ~= nil and data.variable_name ~= nil then --checking the data is saved/there
        inst.varaible_name = data.variable_name --re-introducing the data which was saved
    end
end

 

btdubs if the esctemplate doesn't already have a save function simpy put
 


--inst.vairable_name = 0--data
inst.OnSave = function_name

So I tried copying what you told me but it still isnt working

I attached the prefab and the client log if that helps

it doesnt crash or anything but the stats just still dont get saved

esctemplate.lua client_log.txt

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...