I wanna make a hacking computer games.And i want the player look at computer. These is my coding, and thanks for helping!
local player = game.Players.LocalPlayer local character = player.Character.Humanoid local Computer = game.Workspace.Computer.Keyboard.Body local radius = 10 function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.E then if player:DistanceFromCharacter(Computer.Position) <= radius then character:MoveTo(workspace.Computer.Hack.Position) --Rotate myself please C: end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
When you're rotating a player to make them face something, use CFrame. This particular method can be found in the second entry on this page under Quick Reference.
character.Parent.Head.CFrame = CFrame.new(character.Parent.Head.Position,Computer.Position) -- character.Parent is used because you define character as their humanoid.