I have probably just missed something very obvious but right now, in the middle of the night, I can't figure out why this errors.
1 | height = ((thePart.Position.Y - target.Torso.Position.Y).magnitude) + 60 |
thePart
is already defined as Baseplate
and target
is a npc dummy.
I'm assuming you want to check the distance of the Y value between the two
1 | height = 60 + thePart.Position.Y - target.Torso.Position.Y |
Or if you want the distance between the two
1 | height = ((thePart.Position - target.Torso.Position).magnitude) + 60 |
The error is because you're calling .magnitude on a number value instead of a Vector3
You cannot call the magnitude function on a number because it is inside the Vector3.new array. Therefore
1 | height = ((thePart.Position.Y - target.Torso.Position.Y).magnitude) + 60 |
should be
1 | height = (thePart.Position.Y - target.Torso.Position.Y) + 60 |
Or, alternatively, if you're trying to get the distance between the two positions
1 | height = ((thePart.Position - target.Torso.Position).Magnitude) + 60 |
I suggest you look up the distance formula (Which is ((a1-a2)^2+(b1-b2)^2+(c1-c2)^2)^.5=dist or sqrt((a1-a2)^2+(b1-b2)^2+(c1-c2)^2)=dist) to check your understanding.
Presuming you just want the height, I would go with the first solution.
Sources: Magnitude, Distance formula