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

This dodging script should work but the character is not dodging [playing the animation] Help?

Asked by
Tizzel40 243 Moderation Voter
5 years ago

I all ready made a doging animation that's already in the local script but heres my swords scripts

Every time I hit someone ...they are not doing the doging animation

Here is the script that takes care of the swinging and Fireing the Event! [This woks]...

local Remote = script.Parent:WaitForChild("RemoteEvent")
local canattack = true
local an1 = false
script.Parent.Equipped:Connect(function()
    script.Parent.eqquiped.Value = true
end)

script.Parent.Activated:Connect(function()
    --local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
    local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
    local attack2 = script.Parent.Parent.Humanoid:LoadAnimation(script.secAttack)   
       if canattack then
           attack:Play()
script.Parent.Handle.wooshf:Play()
           canattack = false
            Remote:FireServer()
           wait(.5)
           attack:Stop()
           canattack = true

           an1 = true
    end
end)
script.Parent.Activated:Connect(function()
    --local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
    local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
    local attack2 = script.Parent.Parent.Humanoid:LoadAnimation(script.secAttack)   
       if canattack and an1 == true then
           attack2:Play()
script.Parent.Handle.wooshf:Play()
           canattack = false
            Remote:FireServer()
           wait(.5)
           attack2:Stop()
           canattack = true

           an1 = false
end
end)
script.Parent.Unequipped:Connect(function()
    script.Parent.eqquiped.Value = false
end)

Now Here, I believe this is where the problem is [with this script!!!] every time I hit someone they should do the doging animation if dogging is true if not...they don't

local Remote = Instance.new("RemoteEvent", script.Parent)

local CanDamage = script.Parent:WaitForChild("CanDamage")

Remote.OnServerEvent:Connect(function(Player)
    CanDamage.Value = true
end)

script.Parent.Handle.Touched:Connect(function(p)
    if CanDamage.Value == true then
        CanDamage.Value = false
       local ehum = p and p:FindFirstChild("Humanoid") or p.Parent:FindFirstChild("Humanoid") or p.Parent.Parent:FindFirstChild("Humanoid")
    if ehum and ehum.Doging.Value == false then
        ehum:TakeDamage(22)
  script.Parent.Handle.Sound:Play()
print("no doge...")
elseif ehum and ehum.Doging.Value == true then

    local doge = ehum:LoadAnimation(script.doge1)
     doge:Play()
--  script.Parent.Handle.Sound:Play()
print("doged")
    end
    end
end)
--script.Parent.Handle.Touched:Connect(function(p)
--    if CanDamage.Value == true then
--        CanDamage.Value = false
--       local ehum = p and p.Parent:FindFirstChild("Humanoid") or p.Parent.Parent:FindFirstChild("Humanoid")
--    if ehum and ehum.Doging.Value == true then
--  local doge = ehum:LoadAnimation(script.doge1)
--     doge:Play()
--  script.Parent.Handle.Sound:Play()
--print("doged")
--end
--end
--end)

and the script below is located in the starter Character scripts I have a value called "Doging" [on purpose] and that value is going to be inserted into the humanoid

script.Parent.Parent = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

but my swords swings and all but it dosent make the character doge if there "doging".value equals true and it dosent make the character take damgage if the value is false

please help me...

--T40

Answer this question