The code is syntactically correct but there are a few problems that could be causing the logic error. First and foremost, I do not recommend using the ClassName API. Use the IsA method instead. More specifically, the condition in the if statement should be replaced with i[h]:IsA("BasePart").
What's the difference between Part and BasePart? The answer is simple; Part is only one type of BasePart. There are many types of BaseParts including WedgePart, MeshPart, and TrussPart. Your if statement was only checking for the regular Part. In particular, these aforementioned classes are all subclasses of BasePart. As an analogy, imagine you have many pizzas with different toppings.. You have pepperoni pizzas, cheese pizzas, vegetable pizzas all of which are very different pizzas. However all of these pizzas can be grouped under the more general term, Pizza.
Just a few more small errors (doesn't change the logic in anyway) that I feel deserve to be pointed out. First, you shouldn't use single variable names (unless it's a generally accepted convention, for example the letters i, j, and k in loops, or the letters x and y for coordinates). In your code you use the variable names h and i which aren't very descriptive. Change i to Bullets. The h variable seems like a fairly arbitrary letter. Instead, you should use i instead as it inherently makes its meaning more clear to others. Second, the use of _G is usually frowned down upon because it unnecessarily makes values unsafe and usually hints towards code smell. Try restructuring your design as to avoid the use of _G.
Good luck!
2 comments
Use proper indentation for everyone's sake.
do not make gTime a global becuase they are almost useless now