✓ Accepted answer
Dont use print(tonumber(...).magnitude) only use print((...).magnitude).
for use tonumber you need to use: print(tonumber((...).magnitude)) not print(tonumber(...).magnitude)
and you can use workspace or game.Workspace or game:GetService("Workspace"). but do not use game.workspace
in use magnitude you need to use the parentheses: (...).magnitude Never forget that when using magnitude
Why you get error? you used tonumber(...).magnitude you need to use tonumber((...).magnitude)
Here is fixed script:
while wait(2) do
print(tonumber((workspace.Part1.Position - workspace.Part2.Position).magnitude))
end
Hope it helped :)
1 comment
Thanks!