Look, im making a tower defense game.
but when i try to make the magnitude part (to make the towers have a range and look at enemies)
It wont print the distance. take a look and please help me D:
local tower = workspace.Tower local enabled = false while true do wait() if enabled == false then enabled = true local attack = false for i, v in pairs(workspace.Enemies:GetChildren()) do local distance = (v.Position - script.Parent.Position).magnitude if distance < 15 and attack == false then print("ok") end end end end
i mean, the enemy spawns but the tower dont get the distance, no errors or prints. and when its not duplicated (in the folder) it checks and print