Position.Magnitude not working as intended

I am trying to make a Hitting system for my game where you can hit other players and a hit tracker to show how far the hit was and how far it was from an object, in this case the ‘Puck’ as you can see below I have two screenshots of the distance from the puck (the puck has an arrow pointing to it in the second picture if you didn’t see it) and while one player is obviously farther in the second screenshot than in the first, the game will send the distance back to the Hit Tracker as being almost 3x shorter than the first.

Is there any way I can fix this
Images below
FDFDSSDFFSDfDS
HITDISSS
DSADSADASDSA2
HITDSSS2

Can you show the code which gets the distance from the puck?

Sorry for the late response but here it is
(echar is the players character)

local m1 = game.Workspace.Puck.Position.Magnitude
local m2 = echar.HumanoidRootPart.Position.Magnitude
local distance = math.abs(m1 - m2)

Right now, you’re just getting the difference between the distance of the puck from the origin and the character’s distance from the origin. What you want is:

local m1 = game.Workspace.Puck.Position
local m2 = echar.HumanoidRootPart.Position
local distance = (m1 - m2).Magnitude

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