Hey, I have an issue, my script below works perfectly fine functionally but there’s a big issues, for some reason the animation bugs out and plays 2-3 times, its very glitchy, and I have no idea why…
Here is my script,
script.Parent.OnServerEvent:Connect(function(plr,direction,mouseaim)
local OnHit = false
local Alive = true
local Damage = 20
local hrp = plr.Character:WaitForChild("HumanoidRootPart")
local RS = game:GetService("ReplicatedStorage")
-- FOLDERS --
local Remotes = RS.Remotes
local Tween = game:GetService("TweenService")
local Replicate = Remotes.Replicate
local Remotes2 = RS:WaitForChild("Events"):WaitForChild("Remotes")
local HitCounterRemotes = Remotes2:WaitForChild("HitCounter")
local Hits = {}
local Modules = game.ReplicatedStorage.Modules
local misc = require(Modules.Misc)
local CS = game:GetService("CollectionService")
local tag = "Ragdoll"
local AirImmunityTag = "AirDown"
local M1ImmunityTag = "Immunity"
local flh = game.ReplicatedStorage.Hitboxes.hbox3:Clone()
flh.Parent = workspace.Debris
flh.CFrame = hrp.CFrame *CFrame.new(0,-2,0)
local Sound2 = script:WaitForChild("Hit")
local ia = plr.Character:FindFirstChild("IsAttacking")
spawn(function()
ia.Value = true
wait(1)
ia.Value = false
end)
local TS = game:GetService("TweenService")
local debounce = false
flh.Touched:Connect(function(hit, Player)
if debounce then return end
debounce = true
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name then
if not hit.Parent.Humanoid:FindFirstChild(plr.Name) then
if Hits[hit.Parent.Name] then
return
end
local charh = hit.Parent
local bt = hit.Parent:WaitForChild("BlockTime")
local eHum = hit.Parent.Humanoid
eHum.Parent.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation - Vector3.new(0, 180, 0)
eHum.Parent.HumanoidRootPart.Position = Vector3.new(plr.Character.HumanoidRootPart.Position.X, plr.Character.HumanoidRootPart.Position.Y, plr.Character.HumanoidRootPart.Position.Z - 4)
eHum.WalkSpeed = 0
CS:AddTag(eHum.Parent, M1ImmunityTag)
CS:AddTag(plr.Character.Humanoid.Parent, M1ImmunityTag)
local anim = eHum:LoadAnimation(script.Parent.Parent.SkullCrusherOpposition)
anim:Play()
anim.Stopped:Wait()
CS:RemoveTag(charh, M1ImmunityTag)
CS:RemoveTag(plr.Character.Humanoid.Parent, M1ImmunityTag)
CS:AddTag(charh, AirImmunityTag)
debounce = false
end
end
end)
wait(3)
flh:Destroy()
wait(5)
end)
If anyone could help it would mean so much!