Tweening while animation playing behaving weirdly

Hello everyone,

I’m making a water bottle that has a drinking animation when the tool.Activated function is triggered, and another TweenService animation that plays at the same time to animate the water level changing inside the bottle.

However, because I need the water to tween in only one direction, I have to tween both the size and the position. Therefore, when I tween both, this happens:

Here’s the script inside of the bottle.

local tool = script.Parent
local char = nil

local animation = script.Sip

local sipsLeft = script.SipsLeft.Value

local m6d

local tweenService = game:GetService("TweenService")

local waterpart = script.Parent.Tool.Water

local sizes = {
	[0] = Vector3.new(0, 0.4, 0.56),
	[1] = Vector3.new(0.45, 0.4, 0.56),
	[2] = Vector3.new(0.95, 0.4, 0.56),
	[4] = Vector3.new(1.45, 0.4, 0.56)
}

tool:GetPropertyChangedSignal("Parent"):Connect(function()
	if char then
		return
	end
	if tool.Parent.Name == "Backpack" then
		char = tool.Parent.Parent.Character	
	end
end)

tool.Equipped:Connect(function()
	local a:Weld = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
	m6d = Instance.new("Motor6D")
	m6d.Parent = char:FindFirstChild("Right Arm")
	m6d.Name = "RightGrip"
	m6d.Part0 = a.Part0
	m6d.Part1 = a.Part1
	m6d.C0 = a.C0
	m6d.C1 = a.C1
	a:Destroy()
end)

tool.Unequipped:Connect(function()
	m6d:Destroy()
end)

tool.Activated:Connect(function()
	if sipsLeft > 0 then
		sipsLeft -= 1

		local animator = char:WaitForChild("Humanoid").Animator
		local load = animator:LoadAnimation(animation)

		load:Play()

		local newTween = tweenService:Create(
			waterpart,
			TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut),
			{Size = sizes[sipsLeft], Position = waterpart.Position + Vector3.new(-0.5, 0, 0)}
		)

		newTween:Play()

		print("Played animation,", sipsLeft, "sips left")
	else
		print("No water left!")
		return
	end
end)

Does anyone have any knowledge about this? Any help is appreciated. Thanks in advance!

1 Like

Try changing the “waterpart.Position” line to “bottle.Position” or whatever your bottle is called