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 
I really hope someone can help me with this problem!