What would I use to rotate my player to where my mouse is looking? I have no idea where to start.
Rotate player to mouse position?
1 answer
To do this you would have to use one of the CFrame constructors. You can see a full list here. There is one constructor, that takes two arguments. The first argument is the Vector3 Origin, or where your going to be starting from. the second argument is the Vector3 look at point, or where you're going to be looking at. So to do what you're trying to accomplish, we need to use this CFrame constructor on your character with a starting point of your character's position, and a look to point of your mouse's hit position.
local player = game.Player.LocalPlayer --Player
local mouse = plr:GetMouse --Player's mouse.
local char = plr.Character.Torso --Player's torso.
while wait() do
local dir = (mouse.Hit.p - char.CFrame.p).unit * 100 --lookat point
char.CFrame = CFrame.new(char.CFrame.p,dir)
end
3 comments
Is it possible to make it so the player does not move depending on if you look up or down, only if you look side to side, it rotates?(the Z and X values)
Yes but that's going to require an entirely different method.
At the end of line 6, what does .unit do?
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You can lock the player in first person, otherwise I believe it is up to the player to have MouseLock enabled.