Hi! I have easily made the first script and animation for my tool, I tried to use a randomize the script, but it hasnt worked. Any suggestions?

repeat wait() until game.Players.LocalPlayer.Character
script.Parent.Parent.Equipped:Connect(function()
local Anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.LeftSlash)
script.Parent.Parent.Activated:Connect(function()
Anim:Play()
wait(2)
script.Parent.Parent.Damage.Value = false
end
end)
local CanAttack = true

script.Parent.Activated:connect(function()
 local LeftSlash = script.Parent.Parent.Humanoid:LoadAnimation(script.LeftSlash)
 local RigthSlash = script.Parent.Parent.Humanoid:LoadAnimation(script.RightSlash)
    if CanAttack == true then
local RANDOM_ANIM = math.random(1, 2)
 if RANDOM_ANIM == 1 then
LeftSlash:Play()
elseif RANDOM_ANIM == 2 then
RightSlash:Play()
end
CanAttack = false
wait(1)
LeftSlash:Stop()
RightSlash:Stop()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end

2 comments

0

Hi there. Just noting that you don't have to press the lua button for every single line of code. Just press it once and done.

0

ok ty