Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

i am trying to make a two attack animations that a random but it wont work how do i fix?

Asked by 6 years ago
local plr = game.Players.LocalPlayer
local attack = false
    local mouse = plr:GetMouse()
    local char = plr.Character
script.Parent.Activated:Connect(function()

    local hum = char.Humanoid:LoadAnimation(script.Parent.Animation or script.Parent.Animationsd)
    script.Parent.Blade.Trail.Enabled = true
    hum:Play()
    attack = true
    wait(.50)
    hum:Stop()
    script.Parent.Blade.Trail.Enabled = false

    script.Parent.Blade.Touched:Connect(function(hit)

    local hum =  hit.Parent:FindFirstChild("Humanoid")
    if hum ~= nil and attack == true then
    hum.Health = 0
    attack = false
    end
end)
end)

0
Do you have an idea as to why it may not work? User#19524 175 — 6y
0
nope helleric -3 — 6y
0
Maybe ugly and unindented code is no longer working? lunatic5 409 — 6y

1 answer

Log in to vote
1
Answered by
Epuuc 74
6 years ago
local plr = game.Players.LocalPlayer
local attack = false
local mouse = plr:GetMouse()
local char = plr.Character
script.Parent.Activated:Connect(function()
    local animations = {"Animation","Animationsd"}
    local hum = char.Humanoid:LoadAnimation(script.Parent[animations[math.random(1,#animations)]])
    script.Parent.Blade.Trail.Enabled = true
    hum:Play()
    attack = true
    wait(.50)
    hum:Stop()
    script.Parent.Blade.Trail.Enabled = false
    script.Parent.Blade.Touched:Connect(function(hit)
        local hum =  hit.Parent:FindFirstChild("Humanoid")
        if hum ~= nil and attack == true then
            hum.Health = 0
            attack = false
        end
    end)
end)
0
view the source, for some reason some of line 7 is cut off Epuuc 74 — 6y
Ad

Answer this question