Can't assign a magnitude to a Vector3

So, for a script I am making, I simply wanted to assign a magnitude to a vector. When I ran the game, I got this error: “Magnitude cannot be assigned to”. So I made an isolated script with these contents:

a = Vector3.new(1, 2, 3)
a.Magnitude = 1

print(a.Magnitude)

When I ran it, it again raised an error when it reached the point where I set the magnitude with the same error message “Magnitude cannot be assigned to”.

I have searched for threads with people having similar issues, but it appears like there aren’t any, or maybe I just have a talent to use the wrong search queries. I have also attempted researching it in the developer hub, but I couldn’t find anything helpful there as well.

Does anybody know what I’m doing wrong?

Thanks in advance.

1 Like

Its raising an error because .Magnitude can’t be changed. What are you trying to do?

1 Like

Magnitude is the distance between two objects. you need to get the reference of two objects you are tryint to use magnitude on. What is the Vector3 currently assign too ?

1 Like

for raise magnitude you need do a*your magnitude(for now 1)
but vector is like vector in math so its better to do vector by .Unit function

1 Like

You need to find the unit vector of the vector3 first, and then multiply it by the magnitude to make it that set magnitude.

This is matrix multiplication maths.

4 Likes

Oh, now I get it. I thought magnitude was just nothing more than a value attached to a vector. I’ll do more research into how vectors work. I had thought that I knew all I had to know, but I see that’s not the case.

Thanks everyone.