Uhhhh, so i got this unexpected error, andddd yep.
for _, v in pairs(game.Workspace:GetChildren()) do
if v.Name ~= "Anonymous" and v:FindFirstChild("Humanoid") ~= nil and CheckDist(v.HumanoidRootPart - script.Parent.Torso) <= 70 then
target = v
Uhhhh, so i got this unexpected error, andddd yep.
for _, v in pairs(game.Workspace:GetChildren()) do
if v.Name ~= "Anonymous" and v:FindFirstChild("Humanoid") ~= nil and CheckDist(v.HumanoidRootPart - script.Parent.Torso) <= 70 then
target = v
dude, it's because your trying to subtract a torso and humanoid rootpart, these are objects/instances
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
change CheckDist(v.HumanoidRootPart - script.Parent.Torso) <= 70 to (v.HumanoidRootPart.Position - script.Parent.Torso.Position).Magnitude <= 70
The error is something to do with your function, which I'm not sure what your function is doing. But your parameter is subtracting a HumanoidRootPart from a Torso, not the position.
It's not the checkdist function, It's the Humanoid part.