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

Workspace.Anonymous.Script:20: attempt to perform arithmetic (sub) on Instance?

Asked by 4 years ago

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
0
change CheckDist(v.HumanoidRootPart - script.Parent.Torso) <= 70 to (v.HumanoidRootPart.Position - script.Parent.Torso.Position).Magnitude <= 70 killerbrenden 1537 — 4y
0
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. killerbrenden 1537 — 4y
0
It's not the checkdist function, It's the Humanoid part. CaIcuIati0n 246 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

dude, it's because your trying to subtract a torso and humanoid rootpart, these are objects/instances

Ad

Answer this question