Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my character teleport when rotating the character?

Asked by 5 years ago
Edited 5 years ago

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)
0
A has fromEulerAnglesXYZ and D has fromOrientation because I was testing which one was better LordTechet 53 — 5y

Answer this question