Hello, I Am Trying To Make A Tower Defense Targeting System. All The Code Is Right Allegedly... I am trying to have it when an enemy is in range of the tower. The Tower Will Start Shooting There's Is A Sound In the Gun. But Nothing Plays Or Prints In The Output.
Here is The Code.
local shoot = script.Parent.Humanoid:LoadAnimation(script.Parent.Shoot) local idle = script.Parent.Humanoid:LoadAnimation(script.Parent.Idle) idle:Play() --setup local curzombies = workspace.Objects.CurZombies local char = script.Parent local statistics = script.Parent.Stats -- main for i,V in pairs(curzombies:GetChildren()) do local distance = (V.HumanoidRootPart.Position - char.HumanoidRootPart.Position).magnitude if distance < statistics.Range.Value then print("Shooting") shoot:Play() char.Handle.Attachment.Fire:Play() V.Humanoid.Health = V.Humanoid.Health - statistics.Damage.Value else break end