Tweening heartbeat help

i’m currently revamping my whole ui and one thing that i can’t figure out is how to smoothly tween this heartbeat

so the tweening starts when the heartbeat sound is played
this is my best attempt but ik it can be smoother than that

heartbeat.Played:Connect(function()
	local tween = ts:Create(healthicon, TweenInfo.new(.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut), {Size = UDim2.new(0.65, 0, 0.65, 0)})
	tween:Play()
	tween.Completed:Connect(function()
		healthicon.Size = UDim2.new(0.6, 0, 0.6, 0)
	end)
end)

You can try when the tween is completed do another tween to the back position

If you setup the Tween correctly with the TweenInfo data, then it will repeat automatically:

local tweenInfo = TweenInfo.new(
	5, -- The time the tween takes to complete
	Enum.EasingStyle.Bounce, -- The tween style.
	Enum.EasingDirection.InOut-- EasingDirection
	1, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
	true, -- Reverse on complete
	--0 -- Delay
)
heartbeat.Played:Connect(function()
	local tween = ts:Create(healthicon, tweenInfo,  {Size = UDim2.new(0.65, 0, 0.65, 0)})
	tween:Play()
end)
heartbeat.Played:Connect(function()
	local tween = ts:Create(healthicon, TweenInfo.new(.25, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut, 0, true), {Size = UDim2.new(0.65, 0, 0.65, 0)})
	tween:Play()
	tween.Completed:Connect(function()
		healthicon.Size = UDim2.new(0.6, 0, 0.6, 0)
	end)
end)

yup this works! very much smoother, thanks! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.