I want to make a random animation to play everytime Player presses “MouseButton1”
but only one animation plays, it doesn’t play the other animation.
I tried to find solutions but did not receive any answers at all.
This is my code:
local debounce = false
local part23 = script.Parent
local animations = {script.Parent:WaitForChild("Slice") , script.Parent:WaitForChild("Slice2")}
script.Parent.Equipped:Connect(function(Mouse)
local slice = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animations[math.random(1,#animations)])
Mouse.Button1Down:Connect(function()
animation:Stop()
if not debounce then
wait(0.1)
slice:Play()
script.Parent.Handle.Touched:Connect(function(hit)
if slice.IsPlaying then
if script.Parent.Value.Value == 0 then
script.Parent.Handle.Union.Transparency = 0
print("works")
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(15)
script.Parent.Value.Value = 1
end
end
end
Any solutions please?