Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My towers attack isn't working, all you can do is place it, and when you do it just stands there?

Asked by 2 years ago
Edited 2 years ago

When I place a tower this error comes up

ServerScriptService.Main.Tower:51: ServerScriptService.Main.Tower:15: attempt to index nil with 'HumanoidRootPart'

my mobs have Root Parts and before I show the code WaitForChild does not work, here's line 15

local distance = (target.HumanoidRootPart.Position - newTower.HumanoidRootPart.Position).Magnitude

and here's line 51

coroutine.wrap(tower.Attack)(newTower)

I'm watching a tutorial and it said this is how line 10 should be to get line 15 working but has you can see its still not working

function FindNearestTarget(newTower)

line 10 is not the problem I think I just though I should include it and it said in the tuturiul it was ok if the animations not working.

Answer this question