Hey I’m a beginner and I need some help with something. I’m trying to make the players head follow the mouse. I used CFrame.lookat() but when I tested it out the player started having a seizure (shaking really fast) I also couldnt move. Heres the code:
--- In startercharacter scripts (server script)
script.Parent["lookAt()"].OnServerEvent:Connect(function(player, mousePOS)
print(mousePOS)
local head = script.Parent:WaitForChild("Head")
head.CFrame = CFrame.lookAt(head.Position, Vector3.new(mousePOS))
end)
--- In startercharacter scripts (local Script)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
while true do
wait(0.001)
script.Parent["lookAt()"]:FireServer(mouse.Hit)
end
Then there’s a remote event in starter character scripts.
I feel like there’s a lot of improvements my codes needs anyways so help me out.