I'm attempting to make a free look like the one in rust

local Cas = game:GetService("ContextActionService")
local Char = game.Players.LocalPlayer.Character
local Camera = game.Workspace.Camera
local Mouse = game.Players.LocalPlayer:GetMouse()
local Down



local function AltFunction(A, Status, B)
	if Status == Enum.UserInputState.Begin then
		Down = true
		Camera.CameraType = Enum.CameraType.Scriptable
		while Down do
			wait()
			local LookVector = Mouse.Hit.LookVector
			Camera.CFrame = Char.Head.CFrame * CFrame.fromAxisAngle(LookVector * Char.Head.Position, .5) + Vector3.new(0,2,0)
			
		end
	end
	if Status == Enum.UserInputState.End then
		Down = false
		Camera.CameraType = Enum.CameraType.Custom
	end
	
end



Cas:BindAction("FreeLook", AltFunction, false, Enum.KeyCode.LeftAlt)

I cant seem to make it follow the mouse. Any tips?

2 Likes