--Cooldowns
local Cooldown = false
local CDTime = 25
local Damage = script.damageVal.Value
local KnockbackSpeed = 100
local TweenService = game:GetService('TweenService')
--Functions
script.Parent.Parent.RemoteEvent.OnServerEvent:Connect(function(Player)
	if Cooldown then return end
	--Cooldown
	local CDService = coroutine.create(function()
		if Cooldown == true then
			for i = 1,25 do do
			wait(1)
			if Player.PlayerGui.HUD['Move 2'].Text == '1' then
				Player.PlayerGui.HUD['Move 2'].CD2.Value = 25
				Player.PlayerGui.HUD['Move 2'].Text = 'Rasengan'
			else
				Player.PlayerGui.HUD['Move 2'].CD2.Value = Player.PlayerGui.HUD['Move 2'].CD2.Value - 1
						Player.PlayerGui.HUD['Move 2'].Text = Player.PlayerGui.HUD['Move 2'].CD2.Value
					end
				end
			end
		end
	end)
	--Cooldown?
	spawn(function()
		Cooldown = true
	end)
	--Animation
	local animationTrack = Instance.new("Animation")
	animationTrack.AnimationId = 'rbxassetid://5858480062'
	local RasenAnim = Player.Character.Humanoid:LoadAnimation(animationTrack)
	RasenAnim:Play(0)
	--Sound
	local RasenSound = Instance.new('Sound')
	RasenSound.SoundId = 'rbxassetid://297469954'
	RasenSound.Parent = Player.Character.HumanoidRootPart
	RasenSound:Play()
	--Make the Rasengan and attach it to the character 
	local RasenganPre = game.ReplicatedStorage.MinatoFGNW.Other.FirstCore:Clone()
	RasenganPre.Parent = Player.Character['Right Arm']
	local Weld = Instance.new('Weld', RasenganPre)
	Weld.Part0 =  RasenganPre
	Weld.Part1 = Player.Character['Right Arm']
    Weld.C1 = CFrame.new(0,-1.4,0)
	--Start the TweenService
	wait(2)
	local Rasengan = game.ReplicatedStorage.MinatoFGNW.Other.Core:Clone()
	Rasengan.Parent = Player.Character['Right Arm']
	local Weld = Instance.new('Weld', Rasengan)
	Weld.Part0 = Rasengan
	Weld.Part1 = Player.Character['Right Arm']
	Weld.C1 = CFrame.new(0,-1.4,0)
	RasenganPre:Destroy()
	--If someone touches the Rasengan then do damage.
	Rasengan.Touched:Connect(function(hit)
		if Rasengan.Size == Vector3.new(1,1,1) then
			if hit and hit.Parent == Player.Character then return end
			if hit and hit.Parent:FindFirstChild('Humanoid') then
				local Enemy = hit.Parent:FindFirstChild('Humanoid')
				Enemy:TakeDamage(Damage)
				RasenAnim:Stop()
				RasenSound:Stop()
				Rasengan:Destroy()
				--KnockbackAdded to the hit player
				local BodyVelocity = Instance.new('BodyVelocity',hit.Parent.HumanoidRootPart)
				BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * KnockbackSpeed
				BodyVelocity.MaxForce = Vector3.new(35000, 35000, 35000)
				game.Debris:AddItem(BodyVelocity,.4)
				--Cooldown
				spawn(function()
					Cooldown = true
					coroutine.resume(CDService)
					wait(CDTime)
					Cooldown = false
				end)
				--HitAnimation
				local HitAnim = Instance.new('Animation')
				HitAnim.AnimationId = 'rbxassetid://5858482009'
				local HitAnimm = hit.Parent.Humanoid:LoadAnimation(HitAnim)
				HitAnimm:Play()
				--HitSound
				local HitSound = Instance.new('Sound',Player.Character.HumanoidRootPart)
				HitSound.SoundId = 'rbxassetid://907579214'
				HitSound.Volume = .342069
				HitSound:Play()
				wait(1)
				HitAnimm:Stop() 
			end
		end
	end)
	--Times out the Rasengan after 6.9 seconds
	if Cooldown == false then
		print('Rasengan Completed')
	elseif Cooldown == true then
		spawn(function()
			wait(6.9)
			print('deleted rasengan')
			print(Cooldown)
			RasenAnim:Stop()
			Rasengan:Destroy()
			RasenSound:Stop()
			Cooldown = false
		end)
	end
end)

The cooldown is supposed to take effect right when the Rasengan:Connect happens, while it does go on cooldown, the timeout function for it still takes place, i want to avoid this but for some reason Cooldown = true after i make a spawn(function()) making it false, any ideas?