Tween Getting Cancelled At Random

So, I’ve been trying to tween an IntValue on the client with a LocalScript.

The IntValue is a value that controls the progress of a custom ProximityPrompt.

image

Here’s part of the script:

ProgressValue.Changed:Connect(function(value)
	print(value)
	local angle = math.clamp(value*360,0,360)
	StartGradient.Rotation = math.clamp(angle,0,180)
	FinishGradient.Rotation = math.clamp(angle,180,360)
end)
function PlayStartTween() -- this is called when i click on the prompt
	local tweenTime = CurrentProximity.HoldDuration*(1 - ProgressValue.Value)
		print(tweenTime)
		HoldStartTween = TweenService:Create(ProgressValue,
			TweenInfo.new(tweenTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),
			{Value = 1})
		HoldStartTween:Play()
		print(HoldStartTween.PlaybackState)
		print(HoldStartTween.TweenInfo)
		delay(tweenTime/2,function()
			warn(HoldStartTween.PlaybackState)
		end)
		delay(tweenTime,function()
			warn(HoldStartTween.PlaybackState)
		end)
		local completedConnection
		completedConnection = HoldStartTween.Completed:Connect(function(playbackState)
			print("completed")
The output I expect is this:
1
Enum.PlaybackState.Playing
Time:1 DelayTime:0 RepeatCount:0 Reverses:False EasingDirection:Out EasingStyle:Linear
- Enum.PlaybackState.Playing
- Enum.PlaybackState.Completed
Instead, I get this:
1
Enum.PlaybackState.Playing
Time:1 DelayTime:0 RepeatCount:0 Reverses:False EasingDirection:Out EasingStyle:Linear
- Enum.PlaybackState.Cancelled
- Enum.PlaybackState.Cancelled

Notice how the state in the middle of the tween is cancelled, and so when it’s supposed to be completed.


It never prints “completed” at the end. Instead, the tween gets canceled.

There isn’t any other parts that cancel out the tween.

And the value’s Changed event never fires because the value never gets tweened as somehow its cancelled.


Is there a problem or something I’m doing wrong? I checked a lot of posts regarding client tweens and tweens not working, but they didn’t help much.

If you can help solve this confusing problem, that would be great.

Shouldn’t you use a numbervalue? Intvalues can’t store decimals.