Part going to weird place occasionally

The right door is doing what it should, and the left one occasionally goes to around 0, 0, 0. Does anyone know why this is happening?
EDIT: The right one is also doing it


Script:

local tweenInfo = TweenInfo.new(
	0.1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local openLeftDoorTween1 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Left"], tweenInfo, {Position = Vector3.new(-10.375, 2, -11.625)})
local openLeftDoorTween2 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Left"], tweenInfo, {CFrame = CFrame.Angles(0, math.rad(-90), 0)})
local closeLeftDoorTween1 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Left"], tweenInfo, {Position = Vector3.new(-9.375, 2, -12.875)})
local closeLeftDoorTween2 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Left"], tweenInfo, {CFrame = CFrame.Angles(0, math.rad(0), 0)})
local openRightDoorTween1 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Right"], tweenInfo, {Position = Vector3.new(-5.625, 2, -11.625)})
local openRightDoorTween2 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Right"], tweenInfo, {CFrame = CFrame.Angles(0, math.rad(90), 0)})
local closeRightDoorTween1 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Right"], tweenInfo, {Position = Vector3.new(-6.625, 2, -12.875)})
local closeRightDoorTween2 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Right"], tweenInfo, {CFrame = CFrame.Angles(0, math.rad(0), 0)})

local function openWardrobe()
	wardrobeHover = true
	openLeftDoorTween1:Play()
	openLeftDoorTween2:Play()
	openRightDoorTween1:Play()
	openRightDoorTween2:Play()
end
local function closeWardrobe()
	wardrobeHover = false
	closeLeftDoorTween1:Play()
	closeLeftDoorTween2:Play()
	closeRightDoorTween1:Play()
	closeRightDoorTween2:Play()
end

game.Players.LocalPlayer.PlayerGui.ScreenGui.Appearance.MouseEnter:Connect(function()
	if wardrobeHover == false then
		openWardrobe()
	end
end)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Appearance.MouseLeave:Connect(function()
	if wardrobeHover == true then
		closeWardrobe()
	end
end)

It might be a debounce issue, try to add in a debounce and retest.

1 Like

The tweens for the cframes cause the doors to go towards the origin. If you combine the tweens together into a single CFrame tween then it shouldn’t move like that.

E.g.

local openLeftDoorTween1 = game.TweenService:Create(workspace["Wardrobe Doors"]["Wardrobe Draw Left"], tweenInfo, {CFrame = CFrame.new(-10.375, 2, -11.625) * CFrame.Angles(0, math.rad(-90), 0)})