Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

(answered) What is .unit? Is it Depreciated? Might be breaking script.

Hey, so I'm working on redoing some of the classic ROBLOX weapon scripts, and the script for the paintball gun wasn't working properly, so I was going through it, and I found this odd thing called ".unit". My questions are above.

Here is the part of the script that has it:

local lookAt = (targetPos - character.Head.Position).unit

1 answer

✓ Accepted answer

#You should be good

Unit is not deprecated, as far as I can tell.

Unit on the APIReference is described as: "A normalized copy of the vector - one which has the same direction as the original but a magnitude of 1"

Basically it makes a Vector3 only represent direction and not magnitude.

1 comment

0

Thanks, the reason why I freaked out was because I couldn't find anything under the APIReference. Thank you for your help!

This discussion is preserved as it was. New answers, comments, and votes are closed.