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

Cframe issues with saving rotation?

Asked by 8 years ago

I'm trying to make a 2D game, and i've disabled W and S but one thing i've noticed is that players can push each other, which then could possibly make them fall off the map. attempt 1:

local character = script.Parent
while true do
wait(.1)
character.Torso.CFrame = CFrame.new(character.Torso.Position.x, character.Torso.Position.y, -0.4)
end
--print("result: moving looks weird, as the character will keep resetting its position, and therefore not allowing the character to turn around.")

attempt 2:

local character = script.Parent
while true do
wait(.1)
character.Torso.CFrame = CFrame.new(character.Torso.Position.x, character.Torso.Position.y, -0.4)
character.Torso.Rotation = Vector3.new(character.Torso.Rotation.x, character.Torso.Rotation.y, character.Torso.Rotation.z)
end
--print("just throws an error and breaks my ContextActionService script.")

Answer this question