We use cookies on this site to enhance your user experience

Sep 04 2018, 1:39 PM PST

-- Function that is called when the player moves their mouse or finger
local function onAim()
	-- Make sure the character exists
	if player.Character then
		-- Finds the position of the mouse in the world and rotates the character model to face it
		local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
		local mouseLocation = Vector3.new(mouse.Hit.X, rootPart.Position.Y, mouse.Hit.Z)
		rootPart.CFrame = CFrame.new(rootPart.Position, mouseLocation)