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

Tower has an error when it attacks?

Asked by 2 years ago

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?

0
try a WaitForChild() Puppynniko 1059 — 2y
0
where epet6644 0 — 2y

Answer this question