Infinite yield possible on 'Workspace.Felipe:WaitForChild("humanoid")'?
I'll explain my situation.
so this is a Round script or intermission script you'll notice that when looking at my script below,so when you join a game and the first round start, its fine,but on the second round this is where everything will break.
01 | for i = GameTime, 0 , - 1 do |
02 | if game.Workspace.Felipe:WaitForChild( "humanoid" ).Health = = 0 then |
05 | elseif game.Workspace.Felipe:WaitForChild( "humanoid" ).Health ~ = 0 then |
07 | ChangeText( 'GameTime ' ..i) |
this is where the error is found,the error only shows when on the second round.
is there something im missing? cause im confused af.
please help!
008 | Settings = require(script.Settings) |
011 | Intermission = Settings.Intermission |
012 | GameTime = Settings.GameTime |
017 | game.Lighting.FogEnd = 200 |
018 | local Sky = game.ReplicatedStorage.Sky:Clone() |
019 | Sky.Parent = game.Lighting |
023 | game.Lighting.FogEnd = 1000000000 |
024 | local Sky = game.ReplicatedStorage.DaySky:Clone() |
025 | Sky.Parent = game.Lighting |
029 | function GameWait(Time) |
040 | if game.Workspace.Felipe.humanoid.Health = = 0 then |
046 | function ChangeText(Text) |
047 | local Players = game.Players:GetPlayers() |
048 | for i = 1 , #Players do |
049 | Players [ i ] .PlayerGui:WaitForChild( "Main" ).Time.Text = Text |
057 | local GameSettings = math.random( 1 , 2 ) |
059 | for i = Intermission, 0 , - 1 do |
060 | ChangeText( 'Intermission ' ..i) |
064 | local Players = game.Players:GetPlayers() |
065 | for i = 1 , #Players do |
066 | Players [ i ] .PlayerGui.SpectateGui.Enabled = false |
068 | Players [ i ] .Playing.Value = true |
072 | ChangeText( 'Game starting...' ) |
074 | if GameSettings = = 1 then |
076 | elseif GameSettings = = 2 then |
083 | local Players = game.Players:GetPlayers() |
084 | game.Workspace.GameProg.Value = true |
085 | for i = 1 , #Players do |
086 | if Players [ i ] .Playing.Value = = true and Players [ i ] .isAFK.Value = = false then |
088 | Players [ i ] .Character.Torso.CFrame = game.Workspace.TP.CFrame |
091 | Players [ i ] .Character.Humanoid.WalkSpeed = 0 |
096 | ChangeText( 'Starting in ' ..i) |
100 | local Players = game.Players:GetPlayers() |
102 | for i = 1 , #Players do |
103 | if Players [ i ] .Playing.Value = = true then |
104 | if Players [ i ] .CurrentGun.Value = = "Glock" then |
105 | local Weapon = game.ReplicatedStorage.Glock |
106 | Weapon:Clone().Parent = Players [ i ] .Backpack |
107 | elseif Players [ i ] .CurrentGun.Value = = "AWM" then |
108 | local Awm = game.ReplicatedStorage.Awm |
109 | Awm:Clone().Parent = Players [ i ] .Backpack |
111 | elseif Players [ i ] .CurrentGun.Value = = "M4A1" then |
114 | Players [ i ] .Character.Humanoid.WalkSpeed = 16 |
124 | for i = GameTime, 0 , - 1 do |
125 | if game.Workspace.Felipe:WaitForChild( "humanoid" ).Health = = 0 then |
128 | elseif game.Workspace.Felipe:WaitForChild( "humanoid" ).Health ~ = 0 then |
130 | ChangeText( 'GameTime ' ..i) |
136 | local Players = game.Players:GetPlayers() |
137 | for i = 1 , #Players do |
138 | if Players [ i ] .Playing.Value = = true then |
139 | table.insert(Winners, Players [ i ] .Name) |
140 | Players [ i ] .leaderstats.Money.Value = Players [ i ] .leaderstats.Money.Value + 10 |
141 | Players [ i ] .leaderstats.Wins.Value = Players [ i ] .leaderstats.Wins.Value + 0.5 |
142 | Players [ i ] .Character.Humanoid.Health = 0 |
143 | Players [ i ] .Playing.Value = false |
147 | if GameSettings = = 1 then |
148 | game.Lighting:FindFirstChild( "DaySky" ):Destroy() |
149 | elseif GameSettings = = 2 then |
150 | game.Lighting:FindFirstChild( "Sky" ):Destroy() |
151 | game.Lighting.FogEnd = 1000000000 |
154 | for i,v in pairs (game.Workspace.MinionsFOLD:GetChildren()) do |
158 | game.Workspace.GameProg.Value = false |
159 | ChangeText( 'GAME OVER!' ) |