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

Attack move is failing to activate?

Asked by 4 years ago
Edited 4 years ago

It's an attack move and I've had players complain this specific move isn't working, but I'm not the best developer yet so I'm having problems fixing it. (sorry for the sloppy code)

local module = {}

local MainModule = require(game.ServerScriptService.MainModule)
module.fire = function(player,name,cf,targ)
    local stun = Instance.new("Animation")
stun.AnimationId = "rbxassetid://1203208218"






    local char = player.Character
    local root = player.Character.HumanoidRootPart
    local ball = script.Ball:clone()
    ball.Parent = workspace

    local pos = char.Head.Position + CFrame.new(char.Head.Position,cf.p).lookVector 
    ball.CFrame = player.Character.Torso.CFrame*CFrame.new(0,-3,0)

    local Anim = player.Character.Humanoid:LoadAnimation(script.Charge)
    Anim:Play()


local HitAnim = player.Character.Humanoid:LoadAnimation(script.HitAnim)

    local disab = Instance.new("BoolValue", player.Character)
    disab.Name = "TrueDisable"
















    local disab2 = Instance.new("BoolValue")
    disab2.Parent = player.Character
    disab2.Name = "Disable"

    for i = 1,10 do
        ball.CFrame = player.Character.HumanoidRootPart.CFrame*CFrame.new(0,-2.5,0)
        ball.Decal.Transparency = ball.Decal.Transparency - 0.1
        wait(.05)
    end
    ball.CFrame = player.Character.HumanoidRootPart.CFrame*CFrame.new(0,-3,0)


        game.Debris:AddItem(ball, 3)
        game.Debris:AddItem(disab, 3)
        game.Debris:AddItem(disab2, 3)





    local en = true
    local c = nil



    c = ball.Touched:connect(function(hit)
        if hit and hit.Parent and hit.Parent.Parent and not hit:IsDescendantOf(char) then
            local ehum = hit.Parent:findFirstChild("Humanoid") or  hit.Parent:findFirstChild("Humanoid") 
            local stuntrack = ehum:LoadAnimation(stun)
            if ehum then
                if not en then return end
                en = false
                ball.HasHit.Value = true
                Anim:Stop()
                HitAnim:Play()
                     local chak = script.ChakraParticle:Clone()
                chak.Parent = player.Character["Left Arm"]

                     local chak2 = script.ChakraParticle:Clone()
                chak2.Parent = player.Character["Right Arm"]



         local f2 = script.LocalScript:Clone()
                f2.Parent = ehum.Parent
                f2.Disabled = false

            local disab = Instance.new("BoolValue", player.Character)
    disab.Name = "TrueDisable"



    local disab2 = Instance.new("BoolValue")
    disab2.Parent = player.Character
    disab2.Name = "Disable"


            ehum.Parent.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-1)






                stuntrack:Play()

                for i = 1,48 do
                local   ball2 = script.Hit2:Clone()
                ball2.Parent = workspace
                fade = script.Hit2.Script:Clone()
                fade.Parent = ball2
                fade.Disabled = false
                local expd2 = Instance.new("BodyVelocity")
        expd2.Name = "expldoded"
        expd2.Velocity = player.Character.Torso.CFrame.lookVector*75
        expd2.MaxForce = Vector3.new(1e9,1e9,1e9)
        expd2.Parent = ball2                            


                local   f = script.HitSound:Clone()
        ball2.CFrame = ehum.Parent.HumanoidRootPart.CFrame*CFrame.new(math.random(-1,1),math.random(-1,1),0.5)
        ball2.CanCollide = false
        ball2.Anchored = true
        f.Parent = ball2
    f:Play()

    game.ReplicatedStorage.Events.ChakraT:Fire(player,'Deplete',game.Players:GetPlayerFromCharacter(hit.Parent), math.random(4,7))
        wait(.05)






        game.Debris:AddItem(ball2, 0.3)


                end
                        local Finish = player.Character.Humanoid:LoadAnimation(script.Finish)
    Finish:Play()






                local expd = Instance.new("BodyVelocity")
        expd.Name = "expldoded"
        expd.Velocity = player.Character.Torso.CFrame.lookVector*75
        expd.MaxForce = Vector3.new(1e9,1e9,1e9)
        expd.Parent = ehum.Parent.HumanoidRootPart                          
        game.Debris:AddItem(expd,0.25)
        MainModule.TagHumanoid(player,ehum,350)
                wait()
                HitAnim:Stop()
        disab:Destroy()
        disab2:Destroy()
        chak2:Destroy()
        chak:Destroy()




                wait(0.2)

                c:disconnect()

                if ball then
                    ball:Destroy()
                end
            end
        end
    end)
    wait(3)


    if not en then

        if ball then
            ball:Destroy()
        end
    elseif en and (ball.HasHit.Value ~= true) then
        en = false

        if ball then
            ball:Destroy()
        end
    end
end



return module

Answer this question