#Need help

33 messages · Page 1 of 1 (latest)

wide dock
#

Every time I fireserver it runs a extra time

#

``--Animation Handler
local AnimationRemote = rs.Remotes.AnimationRemote

AnimationRemote.OnClientEvent:Connect(function(anim, var, var2)

local Humanoid = character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local SentAnimation = anim


local function punchanim()
    local animation = Instance.new("Animation")
    animation.AnimationId = SentAnimation
    local playAnimation = Humanoid:LoadAnimation(animation)
            AnimationRemote:FireServer("CombatAnim")
    playAnimation:Play()
     
end``
#

shouldnt be stacking like that not sure why

narrow terrace
#

add cooldown

wide dock
narrow terrace
#

cuz you did it wrong

random spade
#

????????

narrow terrace
#

add the if not debounce after the local SentAnimation

random spade
#

who ping

narrow terrace
#

not me

wide dock
narrow terrace
#

the task.wait and debounce = false is correct in their position

wide dock
#

fireserver in the if statemetn?

narrow terrace
#

give me the script copy paste here

#

i will show you the correct one

wide dock
#

``local AnimationRemote = rs.Remotes.AnimationRemote

local debounce = false

AnimationRemote.OnClientEvent:Connect(function(anim, var, var2)

local Humanoid = character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local SentAnimation = anim


local function punchanim()
    local animation = Instance.new("Animation")
    animation.AnimationId = SentAnimation
    local playAnimation = Humanoid:LoadAnimation(animation)
    if not debounce then
            AnimationRemote:FireServer("CombatAnim")
        debounce  = true
    end
    playAnimation:Play()
    
    task.wait(combatinfo.FistInfo.PunchCooldown)
    debounce = false
     
end

--Block Animations
local function blockanim(player)
    
    
     local function isBlocking()
            local animation = Instance.new("Animation")
            animation.AnimationId = SentAnimation
            animation.Name = "BlockingAnim"
            local playAnimation = Humanoid:LoadAnimation(animation)
            playAnimation:Play() 
     end
     
     local function NotBlocking()
        print(Humanoid:GetPlayingAnimationTracks())
        anim = Humanoid:GetPlayingAnimationTracks()
        for i, anims in pairs(anim) do
            if anims.Name == "BlockingAnim" then
                anims:Stop()
            end
        end
    
     end
            if var2 == "Blocking" then isBlocking() elseif var2 == "NotBlocking" then NotBlocking() else return end
end

if var == 1 then punchanim() elseif var == 2 then blockanim() end

end)
``

narrow terrace
narrow terrace
wide dock
#

?

narrow terrace
#

`

wide dock
#

local debounce = false

AnimationRemote.OnClientEvent:Connect(function(anim, var, var2)
    
    local Humanoid = character:WaitForChild("Humanoid")
    local Animator = Humanoid:WaitForChild("Animator")
    local SentAnimation = anim
    
    
    local function punchanim()
        local animation = Instance.new("Animation")
        animation.AnimationId = SentAnimation
        local playAnimation = Humanoid:LoadAnimation(animation)
        if not debounce then
                AnimationRemote:FireServer("CombatAnim")
            debounce  = true
        end
        playAnimation:Play()
        
        task.wait(combatinfo.FistInfo.PunchCooldown)
        debounce = false
         
    end
    
    --Block Animations
    local function blockanim(player)
        
        
         local function isBlocking()
                local animation = Instance.new("Animation")
                animation.AnimationId = SentAnimation
                animation.Name = "BlockingAnim"
                local playAnimation = Humanoid:LoadAnimation(animation)
                playAnimation:Play() 
         end
         
         local function NotBlocking()
            print(Humanoid:GetPlayingAnimationTracks())
            anim = Humanoid:GetPlayingAnimationTracks()
            for i, anims in pairs(anim) do
                if anims.Name == "BlockingAnim" then
                    anims:Stop()
                end
            end
        
         end
                if var2 == "Blocking" then isBlocking() elseif var2 == "NotBlocking" then NotBlocking() else return end
    end

   if var == 1 then punchanim() elseif var == 2 then blockanim() end
   
end)
narrow terrace
#

wait like this actually mb

wide dock
#

local debounce = false

AnimationRemote.OnClientEvent:Connect(function(anim, var, var2)
    
    local Humanoid = character:WaitForChild("Humanoid")
    local Animator = Humanoid:WaitForChild("Animator")
    local SentAnimation = anim
    
    
    local function punchanim()
        local animation = Instance.new("Animation")
        animation.AnimationId = SentAnimation
        local playAnimation = Humanoid:LoadAnimation(animation)
        if not debounce then
                AnimationRemote:FireServer("CombatAnim")
            debounce  = true
        end
        playAnimation:Play()
        
        task.wait(combatinfo.FistInfo.PunchCooldown)
        debounce = false
         
    end
    
    --Block Animations
    local function blockanim(player)
        
        
         local function isBlocking()
                local animation = Instance.new("Animation")
                animation.AnimationId = SentAnimation
                animation.Name = "BlockingAnim"
                local playAnimation = Humanoid:LoadAnimation(animation)
                playAnimation:Play() 
         end
         
         local function NotBlocking()
            print(Humanoid:GetPlayingAnimationTracks())
            anim = Humanoid:GetPlayingAnimationTracks()
            for i, anims in pairs(anim) do
                if anims.Name == "BlockingAnim" then
                    anims:Stop()
                end
            end
        
         end
                if var2 == "Blocking" then isBlocking() elseif var2 == "NotBlocking" then NotBlocking() else return end
    end

   if var == 1 then punchanim() elseif var == 2 then blockanim() end
   
end)
narrow terrace
#

you did it wrong

#

but words between

wide dock
#
local AnimationRemote = rs.Remotes.AnimationRemote

local debounce = false

AnimationRemote.OnClientEvent:Connect(function(anim, var, var2)
    
    local Humanoid = character:WaitForChild("Humanoid")
    local Animator = Humanoid:WaitForChild("Animator")
    local SentAnimation = anim
    
    
    local function punchanim()
        local animation = Instance.new("Animation")
        animation.AnimationId = SentAnimation
        local playAnimation = Humanoid:LoadAnimation(animation)
        if not debounce then
                AnimationRemote:FireServer("CombatAnim")
            debounce  = true
        end
        playAnimation:Play()
        
        task.wait(combatinfo.FistInfo.PunchCooldown)
        debounce = false
         
    end
    
    --Block Animations
    local function blockanim(player)
        
        
         local function isBlocking()
                local animation = Instance.new("Animation")
                animation.AnimationId = SentAnimation
                animation.Name = "BlockingAnim"
                local playAnimation = Humanoid:LoadAnimation(animation)
                playAnimation:Play() 
         end
         
         local function NotBlocking()
            print(Humanoid:GetPlayingAnimationTracks())
            anim = Humanoid:GetPlayingAnimationTracks()
            for i, anims in pairs(anim) do
                if anims.Name == "BlockingAnim" then
                    anims:Stop()
                end
            end
        
         end
                if var2 == "Blocking" then isBlocking() elseif var2 == "NotBlocking" then NotBlocking() else return end
    end

   if var == 1 then punchanim() elseif var == 2 then blockanim() end
   
end)

narrow terrace
#
lua local AnimationRemote = rs.Remotes.AnimationRemote

local debounce = false

AnimationRemote.OnClientEvent:Connect(function(anim, var, var2)
    
    local Humanoid = character:WaitForChild("Humanoid")
    local Animator = Humanoid:WaitForChild("Animator")
    local SentAnimation = anim

      if not debounce then
            debounce  = true
    
    
    local function punchanim()
        local animation = Instance.new("Animation")
        animation.AnimationId = SentAnimation
        local playAnimation = Humanoid:LoadAnimation(animation)
        AnimationRemote:FireServer("CombatAnim")
        playAnimation:Play()
         
    end
    
    --Block Animations
    local function blockanim(player)
        
        
         local function isBlocking()
                local animation = Instance.new("Animation")
                animation.AnimationId = SentAnimation
                animation.Name = "BlockingAnim"
                local playAnimation = Humanoid:LoadAnimation(animation)
                playAnimation:Play() 
         end
         
         local function NotBlocking()
            print(Humanoid:GetPlayingAnimationTracks())
            anim = Humanoid:GetPlayingAnimationTracks()
            for i, anims in pairs(anim) do
                if anims.Name == "BlockingAnim" then
                    anims:Stop()
                end
            end
        
         end
                if var2 == "Blocking" then isBlocking() elseif var2 == "NotBlocking" then NotBlocking() else return end
    end

   if var == 1 then punchanim() elseif var == 2 then blockanim() end

         task.wait(combatinfo.FistInfo.PunchCooldown)
        debounce = false
end)
#

hope it work

#

cuz i gtg sorry