Cooldown gui doesnt appear when spamming the move button

i have a cooldown gui, and if i dont spam it the cooldown works just fine, but if i tap the ability keybind fast right before the tween ends then the ability still works but the tween doesnt play on the gui. (server sided cooldowns)
this is the script for the button

v.Cooldown.BackgroundTransparency = 0.2
				local track = TS:Create(v.Cooldown, TweenInfo.new(duration), {Size = UDim2.new(0, 65, 0, 0), Position = UDim2.new(0, 0, 1, 0)})
				track.Parent = v.Cooldown
				track:Play()
				local connection
				connection = track.Completed:Connect(function()
					v.Cooldown.BackgroundTransparency = 1
					v.Cooldown.Size = UDim2.new(0, 65, 0, 60)
					v.Cooldown.Position = UDim2.new(0, 0, 0, 0)
					track:Destroy()
					--local recharge = v.Recharge
					--local track2 = TS:Create(recharge, TweenInfo.new(.021, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, true), {BackgroundTransparency = 0.4})
					--track2:Play()
					--track2.Completed:Once(function()
					--	recharge.BackgroundTransparency = 1
					--	track2:Destroy()
					--end)
				end)
				v.Cooldown.Destroying:Connect(function()
					connection:Disconnect()
				end)

fixed it by adding

repeat task.wait() until v.Cooldown.BackgroundTransparency == 1

right above the first line

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