I have a script that tweens a parts orientation to go 90 degrees depending on which direction the player is facing. I want it to smoothly turn, but instead it does a 360. Is there any way to fix it?
here is the code (only the tweening part, since the normal script isn’t the issue.):
function direction()
local dir = workspace.direction
if dir.Value == "normal" and part.Orientation ~= Vector3.new(66, 0, 164) then
local t = ts:Create(part, twinfo, {Orientation = Vector3.new(66, 0, 164)})
t:Play()
elseif dir.Value == "right" and part.Orientation ~= Vector3.new(66, -90, 164) then
--part.Orientation = Vector3.new(45, -90, 164)
local t = ts:Create(part, twinfo, {Orientation = Vector3.new(66, -90, 164)})
t:Play()
elseif dir.Value == "left" and part.Orientation ~= Vector3.new(45.637, 90, 164.658) then
--part.Orientation = Vector3.new(45, 90, 164)
local t = ts:Create(part, twinfo, {Orientation = Vector3.new(45.637, 90, 164.658)})
t:Play()
elseif dir.Value == "back" and part.Orientation ~= Vector3.new(66, -180, 164) then
--part.Orientation = Vector3.new(45, -180, 164)
local t = ts:Create(part, twinfo, {Orientation = Vector3.new(66, -180, 164)})
t:Play()
end
end