Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to save your tycoon? [Unanswered]

Asked by 8 years ago

When player left their tycoon will be saved how they let it behind, when they join back their tycoon spawns back how they did leave it behind. Whats wrong?

game.Players.PlayerRemoving:connect(function(p)
if p:findFirstChild("OwnsTycoon") then
p:SaveInstance("SavedTycoon"..tostring(game.PlaceId),p.OwnsTycoon)
end
end)
game.Players.PlayerAdded:connect(function(p)
for k = 1, 60, 0.03 do
wait()
if p:findFirstChild("OwnsTycoon") and p.DataReady then break end
end
local Loaded = nil
if p:findFirstChild("OwnsTycoon") and pcall(function() Loaded =  p:LoadInstance("SavedTycoon"..tostring(game.PlaceId)) end) then
for j, v in pairs(Loaded:GetChildren()) do
pcall(function() p.OwnsTycoon[v.Name].Model = v.Model end)
end
end
end)

0
Error output or it never happened. rollercoaster57 65 — 8y

Answer this question