PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

SaveInstance

The SaveInstance function was once used by an ancient data persistence method to save an instance which can be loaded again at a later time using /Player/LoadInstance

Parameters

Name Type Default Description

key

Returns

Return Type Summary

Code Samples


Player:SaveInstance

The below code will save ‘Model’, a descendant of Workspace, to the player each time they join the game. To access this instance again, we would need to index it by it’s key, ‘Model’, as defined in the first argument of this method.

game.Players.PlayerAdded:Connect(function(Player)
    Player:WaitForDataReady() 
    Player:SaveInstance("Model", game.Workspace.Model)
end)