#Need help
33 messages · Page 1 of 1 (latest)
``--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
add cooldown
added a cd im still getting the same issue
cuz you did it wrong
????????
add the if not debounce after the local SentAnimation
who ping
not me

add The whole
If not Debounce Then
Debounce = true
after the local SentAnimation
the task.wait and debounce = false is correct in their position
fireserver in the if statemetn?
``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)
``
everything should be in it expect few things
send in a format using this
?
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)
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)
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)
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