Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.