Magnitude Prints Weird When I'm Near but normal when I'm far!

Hello!

I’ve been having this issue when I’m far from a magnitude it just prints (“FAR”) and when I’m close it looks a bit weird!

I have no idea how to even fix this or even explain correctly. Can somebody help?

while task.wait()do
	for i,v in ipairs(workspace.Ambience.Parts:GetChildren()) do
		if (script.Parent.PrimaryPart.Position - v.Position).Magnitude <= 15 then
			print('Near')
		else
			print('Far')
		end
	end
end
1 Like

Could you show us what parts are in the Ambience folder and their locations in workspace as compared to primary part? If it’s checking multiple objects compared to the player, that could be the case. Also, where is this script located?

1 Like

Its just 4 regular parts that are the same
name and they have no scripts. Keep in mind the script is in
The player!

1 Like

By the screenshot you posted, it could just be that the player is near some parts and far from others? What problem are you trying to solve?

3 Likes

Would it be possible to take a screenshot of where the parts are located?

1 Like

Try reducing it to one part temporarily. If that solves the issue, it means that some parts are far from the player and some parts are near, hence why the output is Far Near etc.

1 Like

This is probably the cause, as said, there were four parts, which is probably shows some parts are close and some are far.

Btw The magnitude only detects lower or equal to 15

The reason this is happening, if because you’re going through every one of those parts, some are further away than others. The script isn’t having issues, it’s just some parts are further away from your character than others, which is why some are printing as “Far” and some are “Near”.

1 Like

I found out about that and now, I have no idea how to fix it!

What are you trying to fix? I don’t understand what your intended outcome is as your script is working perfectly fine.

its hard to explain ill do it myself

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.