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

Global dist is only used in the enclosing function; consider changing it to local how do i fix this?

Asked by 5 years ago
Edited 5 years ago

I have a script I wrote while following a long to a detailed YouTube video (its for an AI which follows you) in the vid he uses "dist" and i used it just like he dose

if (head.Position - rootPart.Position).magnitude < dist and humanoid.Health > 0 then
dist = (head.Position - rootPart.Position).magnitude
target = head

the error i keep getting is W003;(12,55)Global dist is only used in the enclosing function; consider changing it to local in script analysis

Dose anyone know how to fix this problem

if you do thx :D

1 answer

Log in to vote
0
Answered by 5 years ago

ok srry for posting this but if any one else has this problem when you defined the variables you did a type-o

Ad

Answer this question