I made an Income script, but I'm getting this error : "Unable to cast value to Object". Here's the entire script for you to see
Income = script.Parent.Configuration.Income CashAmount = Income.Cash.Amount ResearchAmount = Income.Research.Amount Time = Income.Time Owner = Income.Parent.Tycoon.Owner wait() local Player = game.Players:GetPlayerFromCharacter(Owner.Value) local Stats = Player:FindFirstChild("Stats") Cash = Stats:FindFirstChild("Cash") Research = Stats:FindFirstChild("Research") while wait(Time.Value) do Cash.Value = Cash.Value + CashAmount.Value Research.Value = Research.Value + ResearchAmount.Value end
My hierarchy of my game is like this :
Workspace - Space Agency (M) -- Income (S) -- Configuration (C) --- Income (OV) ---- Cash (OV) ----- Amount (IV) ---- Research (OV) ----- Amount (IV) ---- Time (IV)
Where : (M) Model ; (S) Script ; (C) Configuration ; (OV) ObjectValue ; (IV) IntValue
Thanks!