-- Player data table local playerData = {}
local HOME_INCOMES = { ["Starter Shack"] = 25, ["Cozy Cottage"] = 100, ["Modern Mansion"] = 500, ["Luxury Penthouse"] = 2000, ["Ultimate Palace"] = 10000 } ultimate home tycoon script
-- Auto-income loop local function startIncomeLoop() while true do wait(INCOME_INTERVAL) for player, data in pairs(playerData) do if player and player.Parent then -- player still in game local baseIncome = HOME_INCOMES[data.CurrentHome] or 0 local multiplier = data.Upgrades.IncomeMultiplier or 1 local income = math.floor(baseIncome * multiplier) if income > 0 then giveMoney(player, income) -- Optional: floating text effect local remote = remotes:FindFirstChild("ShowIncome") if remote and remote:IsA("RemoteEvent") then remote:FireClient(player, income) end end end end end end -- Player data table local playerData = {}
-- Remote events for client communication local remotes = Instance.new("Folder") remotes.Name = "TycoonRemotes" remotes.Parent = ReplicatedStorage ["Cozy Cottage"] = 100
-- Player join/leave handling local function onPlayerAdded(player) loadPlayerData(player) setupLeaderstats(player) -- Spawn player at their current home's spawn point player:LoadCharacter() player.CharacterAdded:Connect(function(character) wait(0.5) local spawnLocation = workspace:FindFirstChild(playerData[player].CurrentHome .. "Spawn") if spawnLocation and spawnLocation:IsA("SpawnLocation") then local hrp = character:FindFirstChild("HumanoidRootPart") if hrp then hrp.CFrame = spawnLocation.CFrame end end end) end
local function onUpgrade(player, upgradeType) if applyUpgrade(player, upgradeType) then local leaderstats = player:FindFirstChild("leaderstats") if leaderstats then local cashStat = leaderstats:FindFirstChild("Cash") if cashStat then cashStat.Value = playerData[player].Money end end else upgradeRemote:FireClient(player, "Upgrade failed: insufficient funds or already owned.") end end
-- Buy home button local buyCottageBtn = screenGui:FindFirstChild("BuyCottageBtn") if buyCottageBtn then buyCottageBtn.MouseButton1Click:Connect(function() buyHomeRemote:FireServer("Cozy Cottage") end) end