When I place my tower into the game an error pops up that says this ServerScriptService.Main.Tower:51: ServerScriptService.Main.Tower:15: attempt to index nil with 'HumanoidRootPart'
Stack Begin
Script 'ServerScriptService.Main.Tower', Line 51 - function Spawn
Stack End
here is the code for the line it sends me to coroutine.wrap(tower.Attack)(newTower)
here's what part of the code the tutorial said what was wrong local distance = (target.HumanoidRootPart.Position - newTower.HumanoidRootPart.Position).Magnitude
that is what it said to change the code to but its still not working and same for the next part of code function FindNearestTarget(newTower)
Everything else works for the tower except the attack, its animation, and its Damage, what's wrong?

2 comments
try a WaitForChild()
where