Sword only swing once In-Game but work fine In-Studio?

So I have had this error for a week and I really confused about what I was supposed to do, I search all post-related but nothing helps me.

This is a sword swing script:

local Turn = 1
local Cooldown = script.Parent.Cooldown

script.Parent.Activated:Connect(function()	
	if Cooldown.Value ~= true then
		script.Parent.CanDamage.Value = true
		
		local Humanoid = script.Parent.Parent.Humanoid
		local Anim1 = Humanoid:LoadAnimation(script.Parent.Attack1)
		local Anim2 = Humanoid:LoadAnimation(script.Parent.Attack2)


		if Turn == 1 then
			Cooldown.Value = true
			Anim1:Play()
			
			Anim1.Stopped:wait()
			script.Parent.CanDamage.Value = false
			Cooldown.Value = false
			Turn = 2
			
		elseif Turn == 2 then
			Cooldown.Value = true
			Anim2:Play()
			
			Anim2.Stopped:wait()
			script.Parent.CanDamage.Value = false
			Cooldown.Value = false
			Turn = 1
		end
	end
end)

It only swings once in-game, but it works fine in-studio

Also, the sword is cloned from ReplicatedStorage using ServerScript
Here is the script to clone it:

game.ReplicatedStorage.SwordEquip.Event:Connect(function(Sword,Character,Value)
	local Animation = Character.Humanoid:LoadAnimation(script.Animation)
	local Sword = game.ReplicatedStorage.Sword[Sword]:Clone()
	
	Animation:Play()
	
	if Value == true then
		wait(0.5)
		Character.Sword.Handle.Transparency = 1
		Sword.Parent = game.Players[Character.Name].Backpack
		wait()
		Sword.Parent = Character
	else
		wait(0.5)
		Character.Sword.Handle.Transparency = 0
		
		local Rekt = Character:GetChildren()

		for i = 1, #Rekt do
			if Rekt[i]:IsA("Tool") then
				Rekt[i]:Destroy()
			end
		end
	end
end)

Also, I tried to print it and I found out that the cooldown is stuck on the In-Game version, but i can do nothing about it :frowning:

I really hope someone can help me with this problem!

For starters, move the Cooldown.Value = false outside of the if statements and put it at the end so it will always reset. Something like

script.Parent.Activated:Connect(function()
    if Cooldown.Value then return end
    Cooldown.Value = true

    -- Code

    Cooldown.Value = false
end)

Now the script look like this:

local Turn = 1
local Cooldown = script.Parent.Cooldown

local Humanoid = nil
local Anim1 = nil
local Anim2 = nil

script.Parent.Equipped:Connect(function()
	Humanoid = script.Parent.Parent.Humanoid
	Anim1 = Humanoid:LoadAnimation(script.Parent.Attack1)
	Anim2 = Humanoid:LoadAnimation(script.Parent.Attack2)
end)

script.Parent.Activated:Connect(function()	
	if Cooldown.Value then return end
	
	Cooldown.Value = true
	script.Parent.CanDamage.Value = true

	if Turn == 1 then
		Anim1:Play()
			
		Anim1.Stopped:wait()
		Turn = 2
			
	elseif Turn == 2 then
		Anim2:Play()
			
		Anim2.Stopped:wait()
		Turn = 1
	end
		
	script.Parent.CanDamage.Value = false
	Cooldown.Value = false
end)

But still wont work ;-;