Cooldown indication not accurate for some reason?

Ok so pretty much I have a module script (which gets called from a local script) directly before the wait(COOLDOWN) on my moves. And for some reason you can use the move despite the indication still saying there is 0.2 seconds or left or for some of the longer moves u can use them with even 5 seconds still left on the cooldown indicator.

this is the function called before the wait(COOLDOWN) on my moves.

local function CDdisplay(movename,cd)
	pcall(function()
		local a = coroutine.wrap(require(Player.PlayerGui.Stats.cooldowns.CDHandler))
		a(movename,cd)
	end)
end

This is my code:

local sorting = false

local function cdhandler(movename,cd)	
	local cdindicator = script.Parent.CDtextsample:Clone()
	local waittime = 0
	local timecheck = true
	
	local c = coroutine.wrap(function()
		repeat
			wait(.01)
			waittime = waittime + .01
		until timecheck == false
	end)
	c()
	
	cdindicator.Name = "CD"
	if sorting == true then
		repeat
			wait()
		until sorting == false
	end
	sorting = true
	if script.Parent.slot1:FindFirstChild("CD") then
		if script.Parent.slot2:FindFirstChild("CD") then
			if script.Parent.slot3:FindFirstChild("CD") then
				if script.Parent.slot4:FindFirstChild("CD") then
					if script.Parent.slot5:FindFirstChild("CD") then
						if script.Parent.slot6:FindFirstChild("CD") then
							pcall(function()
								script.Parent.slot6.CD:Destroy()
								script.Parent.slot5.CD.Parent = script.Parent.slot6
								script.Parent.slot4.CD.Parent = script.Parent.slot5
								script.Parent.slot3.CD.Parent = script.Parent.slot4
								script.Parent.slot2.CD.Parent = script.Parent.slot3
								script.Parent.slot1.CD.Parent = script.Parent.slot2
							end)
						else
							pcall(function()
								script.Parent.slot5.CD.Parent = script.Parent.slot6
								script.Parent.slot4.CD.Parent = script.Parent.slot5
								script.Parent.slot3.CD.Parent = script.Parent.slot4
								script.Parent.slot2.CD.Parent = script.Parent.slot3
								script.Parent.slot1.CD.Parent = script.Parent.slot2
							end)
						end
					else
						pcall(function()
							script.Parent.slot4.CD.Parent = script.Parent.slot5
							script.Parent.slot3.CD.Parent = script.Parent.slot4
							script.Parent.slot2.CD.Parent = script.Parent.slot3
							script.Parent.slot1.CD.Parent = script.Parent.slot2
						end)
					end
				else
					pcall(function()
						script.Parent.slot3.CD.Parent = script.Parent.slot4
						script.Parent.slot2.CD.Parent = script.Parent.slot3
						script.Parent.slot1.CD.Parent = script.Parent.slot2
					end)
				end
			else
				pcall(function()
					script.Parent.slot2.CD.Parent = script.Parent.slot3
					script.Parent.slot1.CD.Parent = script.Parent.slot2
				end)
			end
		else
			pcall(function()
				script.Parent.slot1.CD.Parent = script.Parent.slot2
			end)
		end
	end
	cdindicator.Parent = script.Parent.slot1
	cdindicator.Visible = true
	sorting = false
	timecheck = false
	cd = cd - waittime
	repeat
		local success,result = pcall(function()
			cdindicator.label.Text = movename.." / "..tostring(math.floor((cd*100)+0.5)/100)
		end)
		cd = cd - 0.1
		wait(.1)
	until success == false or cd <= 0
	
	if cd <= 0 then
		sorting = true
		pcall(function()
			cdindicator.Visible = false
			if cdindicator.Parent == script.Parent.slot1 then
				if script.Parent.slot2:FindFirstChild("CD") then
					script.Parent.slot2.CD.Parent = script.Parent.slot1
				end
			end
			if cdindicator.Parent == script.Parent.slot1 or cdindicator.Parent == script.Parent.slot2 then
				if script.Parent.slot3:FindFirstChild("CD") then
					script.Parent.slot3.CD.Parent = script.Parent.slot2
				end
			end
			
			if cdindicator.Parent == script.Parent.slot1 or cdindicator.Parent == script.Parent.slot2 or cdindicator.Parent == script.Parent.slot3 then
				if script.Parent.slot4:FindFirstChild("CD") then
					script.Parent.slot4.CD.Parent = script.Parent.slot3
				end
			end
			
			if cdindicator.Parent == script.Parent.slot1 or cdindicator.Parent == script.Parent.slot2 or cdindicator.Parent == script.Parent.slot3 or cdindicator.Parent == script.Parent.slot4 then
				if script.Parent.slot5:FindFirstChild("CD") then
					script.Parent.slot5.CD.Parent = script.Parent.slot4
				end
			end
			
			if cdindicator.Parent == script.Parent.slot1 or cdindicator.Parent == script.Parent.slot2 or cdindicator.Parent == script.Parent.slot3 or cdindicator.Parent == script.Parent.slot4 or cdindicator.Parent == script.Parent.slot5 then
				if script.Parent.slot6:FindFirstChild("CD") then
					script.Parent.slot6.CD.Parent = script.Parent.slot5
				end
			end
			
		end)
		cdindicator:Destroy()
		sorting = false
	end
end

return cdhandler

update: I’ve tried adding precautions and prints to try and prevent this but still no solution. Any and all help is greatly appreciated.