Ad
Log in to vote
0

There's an error when a tower attacks?

Asked by 7 days ago

so when my tower try's to attack an error comes up in the output and I doesn't attack nether does it play the animation

here's the error

13:38:55.037 ServerScriptService.Main.Tower:51: ServerScriptService.Main.Tower:15: attempt to index nil with 'HumanoidRootPart' - Server - Tower:51 13:38:55.037 Stack Begin - Studio 13:38:55.037 Script 'ServerScriptService.Main.Tower', Line 51 - function Spawn - Studio - Tower:51 13:38:55.037 Stack End - Studio

here's the lines

this is 51

coroutine.wrap(tower.Attack)(newTower)

here's 15

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

1 answer

Log in to vote
0
Answered by 7 days ago

Based on the error provided, it seems that on line 15, either the target or the newTower doesn't have a HumanoidRootPart. Ensure these objects have the required part by the time this line runs.

Ad

Answer this question