Getting Direction of Player?

This question has obviously been asked before such as here but I’m struggling to figure out on how to do what I’m trying to accomplish.
The goal is the following; clone a object and it’s Position being where the player is, then add a # (let’s do 5) from the player’s orientation. The rest of the code works. The link above mentions LookVector which I got to work but it’s going into the wrong area. Here’s the snippet of code I need fixed,

local e = game.Workspace.Mobs.GrassSlime:Clone()
e.Parent = workspace
CM.Value = e -- Ignore
t.Value = e.Type.Value -- Ignore
e.CFrame = CFrame.new(here's where I'm struggling based on LookVector/Position)

To add off of this, I’m using HumanoidRootPart, in the link above the answer post said using “HRP” which is why it’s using HumanoidRootPart and is defined correctly as in getting it. Any help is appreciated, thanks in advanced,
~Notrealac0unt

1 Like

So this is what im going to assume you are trying to say. You want a part to spawn 5 blocks infront of the player? If so you can find the answer here: How to make a part spawn in front of a player - #2 by prepsure

If you just want the direction the player is moving, ether use the lookvector from the cframe of the humanoidrootpart or use MoveDirection from the humanoid.

Also quick thing, please do not ask for others to fix your code. Most will just give you options and not make the code for you.

3 Likes