WHy does this if tatemenet only run with a task.wait in the middle of it

if Type.Name == "TankInUse" then
				HasTank.Value = false
				Type.Name = "Tank"
				if HasEng.Value == true and Started == true then
					script.Parent.Parent:FindFirstChild("EngInUse").SoundPart.Loop:Stop()
					script.Parent.Parent:FindFirstChild("EngInUse").SoundPart.Fail:Play()
				end
				Started = false
				StopWheels()
			end

This fragment of one of my scripts seems to only run if i put task.wait(2) in between setting the name to tank and the rest of the statement. if i don’t do that, then the while statement does not work anymore…

i just tested it again and now its not working at all anymore

Which part is not working,i can help

Oh,so it is in a while loop

For while loop,u have to put task.wait()

U should put in a for loop if u dont want to put task.wait()

1 Like