trying to make a tycoon
got error:
22:29:30.160 - ServerScriptService.ServerMain:16: attempt to index local 'Tycoon' (a nil value)
22:29:30.161 - Stack Begin
22:29:30.162 - Script 'ServerScriptService.ServerMain', Line 16
22:29:30.163 - Stack End
and this is the code:
function FindEmptyTycoon()
for i,v in pairs(workspace.Tycoons.Tycoon1.RightTycoon:GetChildren()) do
if v.TycoonInfo.Owner.Value == nil then
return v
end
return nil
end
end
game.Players.PlayerAdded:Connect(function(Player)
local Tycoon = FindEmptyTycoon()
Tycoon.TycoonInfo.Owner.Value = Player
local Money = Instance.new("IntValue")
Money.Name = Player.Name
Money.Value = 50
Money.Parent = game.ServerStorage.PlayerMoney
end)

2 comments
thanks for the info but thats not the proplem the proplem is at line 16
i got the same error