So im trying to make an aiming system where your camera and player look at the mouse. How-ever currently it is quite jittery and when you look down or up it flings you into the air..
wait(2)
workspace.Camera.CameraType = Enum.CameraType.Scriptable
local mouse = game.Players.LocalPlayer:GetMouse()
local c = 0
while game:GetService("RunService").Heartbeat:Wait() do
c = c + 1
if c >= 2 then
game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(CFrame.new(game.Players.LocalPlayer.Character:GetPrimaryPartCFrame().p,mouse.Hit.p))
game.Workspace.CurrentCamera.CFrame = CFrame.new(game.Players.LocalPlayer.Character.Head.Position,mouse.Hit.p)
end
end
Please let me know what I am doing wrong! (Also this is done on the client for testing purposes. I know it will not work if the game is FE.)
