SaveInstance (Method)

From Legacy Roblox Wiki
(Redirected from SaveInstance)
Jump to navigationJump to search
SaveInstance( string key, RBX.lua.Instance (Object) value )
Returns nil
Description: Saves a Roblox instance, such as a part that can be reloaded on another server via LoadInstance. The DataComplexity used is the Object's DataCost property. Saving nil removes the entry and frees up DataComplexity units..
Member of: Player


Example
game.Players.PlayerAdded:connect(function(newPlayer)
	newPlayer:WaitForDataReady()
	newPlayer:SaveInstance("Model", game.Workspace.Model)
end)
The above example will save 'Model' (descendant of Workspace) to the player who enters the game. To access this instance again, we need to index it by it's key, 'Model' as defined in the first argument of this method.


See Also