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

How do I make a part 1 stud directly behind the torso?

I already know how to make the the part on the direct position of the torso, but I don't know how to make it one stud behind it.

I tried doing this...

(torso.CFrame+Vector3.new(0,0,1))

It works when you're facing a certain direction, but it will go 1 stud in front of you if you go the other direction, and 1 stud to the left if you move sideways. I need a way to make it where it will always be one stud behind the torso, no matter the direction or position.

Any answers/comments will help.

~SkeletalReality

2 answers

✓ Accepted answer

instead of running;

part.CFrame = (torso.CFrame+Vector3.new(0,0,1))

try running the following:

part.Position = torso.CFrame.LookVector+Vector3.new(0,0,-1)

If it does not work just comment and I'll look into it, this is just the answer I know on the top of my head, so I may be wrong like anybody else. Please accept the answer if it helped!

4 comments

0

Sorry but that doesn't work, it says "attempt to multiply a Vector3 with an incompatible value type or nil"

0

alright let me fix that

0

Try now, and tell me what happens if it does not work

0

I had to change it to torso.CFrame-torso.CFrame.lookVector since I was multiplying by a CFrame Angle, but nevertheless, it worked!

Hey SkeletalReality,

Nice to meet you, I'm KingLoneCat. What you are asking for is actually quiet simple. All you have to do is set the Part's CFrame equal to the Torso's CFrame multiplied by CFrame.new(0, 0, 1). Below is an example of this.

part.CFrame = torso.CFrame * CFrame.new(0, 0, 1);

##It's really quiet that simple. I hope I helped, and have a wonderful day.

~~ KingLoneCat

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