If I press A or D my character turns (Disabled AutoRotates in Humanoid) and my character does turn, therefore my character teleports to the center of the place.

How can I stop my character from teleporting upon turning?

local player = game.Players.LocalPlayer

local character = player.Character.Humanoid

  

function onKeyPress(inputObject, gameProcessedEvent)

if inputObject.KeyCode == Enum.KeyCode.A then

character.Parent.LowerTorso.CFrame = CFrame.fromEulerAnglesXYZ(0, 90, 0)

else

if inputObject.KeyCode == Enum.KeyCode.D then

character.Parent.LowerTorso.CFrame = CFrame.fromOrientation(0, -90, 0)

end

end

end

  

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

1 comment

0

A has fromEulerAnglesXYZ and D has fromOrientation because I was testing which one was better