|
| 30 Jun 2017 02:32 PM |
[HELP ME] The placement system is done - How do i save data?
It functions correct, you can buy furniture from the shop and place it from your inventory on your plot using a kind of Tycoon ownership. The only thing is that i don't know how to make it so it saves the models that are placed on the tycoon once they rejoin or press save and then press Load
|
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:35 PM |
| You can store the model's data and save/load it when the player saves/loads or leaves/rejoins. |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:36 PM |
Player:SaveInstance(key,model)
and
Player:LoadInstance(key) |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:43 PM |
i still don't know how/where to save it to
|
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:47 PM |
game.Player.PlayerAdded:connect(function(plr) plr:LoadInstance(key) end)
game.Players.PlayerRemoving:connect(function(plr) plr:SaveInstance(key,model) end)
|
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:47 PM |
'Player:SaveInstance(key,model)
and
Player:LoadInstance(key)'
Isn't this deprecated? |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:47 PM |
do you mean something like this?
game.Player.PlayerAdded:connect(function(plr) plr:LoadInstance(key) end)
game.Players.PlayerRemoving:connect(function(plr) plr:SaveInstance(key,model) end) |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:51 PM |
With the loadinstance, do
FurnitureModel = plr:LoadInstance(key)
FurnitureModel:MoveTo(anywhere)
|
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:54 PM |
| so what do you mean with key? |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 02:54 PM |
Like this?
game.Player.PlayerAdded:connect(function(plr) FurnitureModel = plr:LoadInstance(key) end)
game.Players.PlayerRemoving:connect(function(plr) FurnitureModel:MoveTo(anywhere) end)
|
|
|
| Report Abuse |
|
|
|
| 30 Jun 2017 09:15 PM |
@Practically have you been living under a rock?
Easiest way imo is to save the cframe components of a hitbox for each furniture piece in a table, then put that in another table and save that
local itemstosave = workspace.items
function save() local tabletosaveto = {} for i, v in pairs(itemstosave:GetChildren()) do table.insert(tabletosaveto,{v.Name,v.PrimaryPart.CFrame:components()}) end game:GetService('DataStoreService'):GetDataStore('blah'):SetAsync('key',tabletosaveto) end
function load(tabletoload) for i, v in pairs(tabletoload) do local item = storagesomewhere:FindFirstChild(v[1]) local new = item:Clone() new:SetPrimaryPartCFrame(CFrame.new(select(2,unpack(v)))) new.Parent = workspace.items end end
|
|
|
| Report Abuse |
|
|