Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make head face mouse?

I don't know how to make head towards mouse, this is my code but it has an error

local player = game.Players.LocalPlayer
local character = player.Character
local pMouse = player:GetMouse()
local neck = character:FindFirstChild("Neck",true)
local runService = game:GetService('RunService')

runService.RenderStepped:Connect(function()
	if neck then
		neck.C1 = (CFrame.new(character.Head.Position,pMouse.Hit.p)):toObjectSpace(character.HumanoidRootPart.Position * neck.C0)
	end
end)

error: attempt to multiply a Vector3 with an incompatible value type or nil

1 answer

Maybe

head.CFrame = CFrame.new(head.Position, mouse.Hit.Position)

in a loop if you want it to keep setting the CFrame, haven't tested so not sure.

1 comment

0

this just makes the player go everywhere, probably have to use neck

This discussion is preserved as it was. New answers, comments, and votes are closed.