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)

1 comment
Error output or it never happened.