I'm having trouble with this. What I want to do is make the player look towards something using XYZ coords. I've tried changing the torso's orientation using Vector3, but doesnt work because it kills the player when rotation happens. How do I do this?
Well we can either use a bodymover, specifically bodygyro or setprimarycframe.
First let's set a position variable
local pos = Vector3.new(0,0,0)
this is where he will look at
When using a bodygyro we will create one, change its 'cframe' then place it inside the humanoidrootpart
local bg=Instance.new("BodyGyro") bg.cframe=pos bg.Parent=character.HumanoidRootPart
Bodygyro final:
local pos = Vector3.new(0,0,0) local bg=Instance.new("BodyGyro") bg.cframe=CFrame.new(pos) bg.Parent=character.HumanoidRootPart
For setprimarycframe, we will use the function :SetPrimaryPartCFrame() to make the humanoidrootpart look in a certain direction, in this case towards the position
character:SetPrimaryPartCFrame(CFrame.new(character.HumanoidRootPart.Position,pos))
Final setprimarycframe
local pos = Vector3.new(0,0,0) character:SetPrimaryPartCFrame(CFrame.new(character.HumanoidRootPart.Position, pos))
I did not set a character variable for both examples.