Hey, Im trying to orient the player to face where ever the camera is facing, and this script should be working but I have no clue why, I also have it in a loop
Note I only want it to orient on the X, Z axises
Code:
local camera = game.Workspace.CurrentCamera
while using do
BodyGyro.CFrame = CFrame.new(camera.CFrame.LookVector.X,0,camera.CFrame.LookVector.Z)
game:GetService("RunService").Heartbeat:Wait()
end
3 Likes
Is it seriously that hard? 
First off, the first 3 values of a cframe are positional values. A lookvector is a unit vector and has a magnitude of one. The CFrame you constructed will always be near thr center of the world.
One way to solve this problem is to use the CFrame.lookAt constructor roblox which takes a positional compenent as its first argument and then a target position for it to rotate too.
BodyGyro.CFrame = CFrame.lookAt( BodyGyro.CFrame.Position, BodyGyro.CFrame.Position + Vector3.new(1,0,1) * camera.CFrame.LookVector)
1 Like
I’ve done this already so ez
this is a local script inside starter character
local Gyro = Instance.new("BodyGyro",player.Character.HumanoidRootPart)
player.Character.Humanoid.AutoRotate = false
game["Run Service"].RenderStepped:Connect(function()
if using then
local Root = player.Character.HumanoidRootPart
Gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
Gyro.D = 100
Gyro.P = 10000
Gyro.CFrame = CFrame.new(Root.Position, Root.Position + Vector3.new(cammer.CFrame.LookVector.X,0,cammer.CFrame.LookVector.Z))
wait()
end
end)
6 Likes
yo your an absolute madlad thanks!
1 Like