Why is there an error in the Zednov Tycoon Kit?
Asked by
4 years ago Edited 4 years ago
I have a problem with the Zednov Tycoon kit, the problem is at line 20, it says that its in infinite yield, I think meaning that it cannot find the button in the PurchasedObjects folder, but I can't find how to fix it!
01 | for i,v in pairs (script.Parent.Buttons:GetChildren()) do |
03 | if v:FindFirstChild( "Head" ) then |
05 | local ThingMade = script.Parent.Purchases:WaitForChild(v.Object.Value) |
06 | if ThingMade ~ = nil then |
07 | Objects [ ThingMade.Name ] = ThingMade:Clone() |
11 | error ( 'Object missing for button: ' ..v.Name.. ', button has been removed' ) |
12 | v.Head.CanCollide = false |
13 | v.Head.Transparency = 1 |
16 | if v:FindFirstChild( "Dependency" ) then |
17 | v.Head.CanCollide = false |
18 | v.Head.Transparency = 1 |
19 | coroutine.resume(coroutine.create( function () |
20 | if script.Parent.PurchasedObjects:WaitForChild(v.Dependency.Value) then |
21 | if Settings [ 'ButtonsFadeIn' ] then |
23 | wait(Settings [ 'FadeInTime' ] / 20 ) |
24 | v.Head.Transparency = v.Head.Transparency - 0.05 |
27 | v.Head.CanCollide = true |
28 | v.Head.Transparency = 0 |
33 | v.Head.Touched:connect( function (hit) |
34 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
35 | if v.Head.CanCollide = = true then |
37 | if script.Parent.Owner.Value = = player then |
38 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
39 | if hit.Parent.Humanoid.Health > 0 then |
40 | local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name) |
41 | if PlayerStats ~ = nil then |
42 | if (v:FindFirstChild( 'Gamepass' )) and (v.Gamepass.Value > = 1 ) then |
43 | if game:GetService( "MarketplaceService" ):PlayerOwnsAsset(player,v.Gamepass.Value) then |
44 | Purchase( { [ 1 ] = v.Price.Value, [ 2 ] = v, [ 3 ] = PlayerStats } ) |
46 | game:GetService( 'MarketplaceService' ):PromptPurchase(player,v.Gamepass.Value) |
48 | elseif (v:FindFirstChild( 'DevProduct' )) and (v.DevProduct.Value > = 1 ) then |
49 | game:GetService( 'MarketplaceService' ):PromptProductPurchase(player,v.DevProduct.Value) |
50 | elseif PlayerStats.Value > = v.Price.Value then |
51 | Purchase( { [ 1 ] = v.Price.Value, [ 2 ] = v, [ 3 ] = PlayerStats } ) |
52 | Sound(v, Settings.Sounds.Purchase) |
54 | Sound(v, Settings.Sounds.ErrorBuy) |