It works with other models, it works in other places also owned by me. But it doesn't work in the place I want it to work, same weapon, same scripts, and same animations used. Equip Script:
wait(0.1)
local tool = script.Parent -- use local variables
local Player = game.Players.LocalPlayer --get the local player
local isitEquipped = Player.hasWeapon
local getName = Player.Name
local attack = workspace:FindFirstChild(getName).Humanoid:LoadAnimation(script.equipAnimation)
tool.Equipped:Connect(function(mouse) -- :Connect not :connect, :connect is deprecated
isitEquipped.Value = true
attack:Play()
attack.KeyframeReached:Connect(function(keyframeName)
if keyframeName == "Pause" then
attack:AdjustSpeed(0)
end
end)
end)
tool.Unequipped:connect(function()
isitEquipped.Value = false
local idle = workspace:FindFirstChild(getName).Humanoid:LoadAnimation(script.Idle)
attack:AdjustSpeed(1)
wait(0.1)
attack:Stop()
end)
Attack Script:
wait(0.1)
local tool = script.Parent
local Player = game.Players.LocalPlayer --get the local player
local Mouse = Player:GetMouse() --get the mouse
local isitEquipped = Player.hasWeapon
local cooldown = 0
local onCooldown = false
local canDamage = false
local critChance
function onClick ()
if isitEquipped.Value == true and script.Parent.Parent.ClassName == "Model" and cooldown == 0 then
local attack = tool.Parent.Humanoid:LoadAnimation(script.Attack) -- script.Parent is tool so just use tool.Parent
attack:Play()
attack:AdjustSpeed(script.Parent.itemSpeed.Value)
print("clicked")
cooldown = 1/script.Parent.itemSpeed.Value
wait(1/script.Parent.itemSpeed.Value)
cooldown = 0
end
end
function damageEnemy (enemy)
if cooldown ~= 0 then
if not canDamage then
canDamage = true
if enemy.Parent:FindFirstChild("Monster") then
critChance = math.random(1,100)
if critChance <= script.Parent.itemCritical.Value then
enemy.Parent.Monster:TakeDamage(script.Parent.itemCritDamage.Value*script.Parent.itemDamage.Value)
else
enemy.Parent.Monster:TakeDamage(script.Parent.itemDamage.Value)
end
wait(script.Parent.itemSpeed.Value)
elseif enemy.Parent:FindFirstChild("Humanoid") and enemy.Parent.Pvp then
if enemy.Parent.Pvp.Value == true then
critChance = math.random(1,100)
if critChance <= script.Parent.itemCritical.Value then
enemy.Parent.Humanoid:TakeDamage(script.Parent.itemCritDamage.Value*script.Parent.itemDamage.Value)
else
enemy.Parent.Humanoid:TakeDamage(script.Parent.itemDamage.Value)
end
wait(script.Parent.itemSpeed.Value)
end
end
canDamage = false
end
end
end
Mouse.Button1Down:connect(onClick)
script.Parent.Part.Touched:connect(damageEnemy)
Is there a way to convert the animations to script since it is so demn complicated --'

2 comments
You're wrapping the KeyframeReached event in an equipped event
Also if you are editing a group game, you have to upload the animations to the group (just a heads up).