I have made an animation for a move in my game for friends and I have this weird bug when you try to walk or when you jump after playing the animation, but when you use a different animation after it stops but it only does that with that specific animation that stops the bug and I couldn’t find a way to replicate it, I have no idea how i fixed it before it just kind of stopped but i went back to add more particles and it started happening again (in the video i was holding S & D while jumping)
I haven’t found anything like this in any of the other posts, so if you have an idea on how to name this so more people can find this post and a possible solution let me know too
Here is the code for the whole thing (its a module script inside of server script service):
local RS = game:GetService("ReplicatedStorage")
local CharConfig = require(RS.SharedModules.Configurations.CharacterConfig)
local AttackDebounces = {}
local module = {}
module.Modules = {}
local AttackHitboxes
local RagdollHandler
local StunHandler
local landed
local attacking
local weld
local glarepos
local positionto
local AttackData = nil
for _, v in CharConfig do
if v.CharacterName == script.Parent.Name then
AttackData = v
break
end
end
module.AttackFunction = function(Player)
if Player.Values.IsAttacking.Value == false and not AttackDebounces[Player] then
if not Player.Character:FindFirstChild("stun") then
AttackDebounces[Player] = true
Player.Values.IsAttacking.Value = true
local Profile = module.Modules.ProfileManager.Profiles[Player]
local Character = Player.Character
local HumanoidRootPart = Character.HumanoidRootPart
local humanoid = Character.Humanoid
local weakpunch = script.WeakPunch:Clone()
local midpunch = script.MidPunch:Clone()
local heavypunch = script.HeavyPunch:Clone()
local ultrapunch = script.UltraPunch:Clone()
local eyesound = script.EyeSound:Clone()
local eyeglare = script["Eye Glare"]:Clone()
local MissSound = script.Miss:Clone()
local BangSound = script.Bang:Clone()
local RackSound = script.Rack:Clone()
local Deci = RS.Assets.DecimatorClassic:Clone()
local stepsound = script.Step:Clone()
local puncheffect = script.PunchEffect:Clone()
local Motor6D = Instance.new("Motor6D")
local victim = nil
local victimrotation
local characterrotation
local direction = (Character.HumanoidRootPart.CFrame.RightVector * -1)
Motor6D.Part0 = Character["Right Arm"]
Motor6D.Part1 = Deci.PrimaryPart
Motor6D.Parent = Deci
for _, v in humanoid:GetPlayingAnimationTracks() do
v:Stop()
end
task.wait(0.1)
local startanim = humanoid.Animator:LoadAnimation(script.Start)
local mainanim = humanoid.Animator:LoadAnimation(script.Main)
startanim:Play()
MissSound.Parent = Character.Torso
MissSound:Play()
startanim:GetMarkerReachedSignal("InitialHit"):Connect(function()
victim = AttackHitboxes.CreateHitbox(Character, Vector3.new(4, 1, 4), 0, false, nil, false, nil, true)
print(victim)
if victim then
landed = true
startanim:Stop()
local victimanim = victim.Humanoid.Animator:LoadAnimation(script.Victim)
midpunch.Parent = Character.Torso
midpunch:Play()
MissSound:Stop()
victim.HumanoidRootPart.Anchored = true
humanoid.AutoRotate = false
humanoid.WalkSpeed = 0
humanoid.JumpHeight = 0
characterrotation = HumanoidRootPart.Orientation
victimrotation = victim.HumanoidRootPart.Orientation
for _, v in victim.Humanoid:GetPlayingAnimationTracks() do
v:Stop()
end
local inv = Instance.new("BoolValue")
inv.Name = "inv"
inv.Parent = Character
inv:Clone().Parent = victim
StunHandler.Stun(victim, 5.5, true, true)
mainanim:Play()
victimanim:Play()
task.spawn(function()
task.wait(0.1)
positionto = HumanoidRootPart.CFrame * CFrame.new(0, -3, -3.5)
victim:PivotTo(positionto * CFrame.Angles(0,math.rad(180),0))
end)
end
end)
mainanim:GetMarkerReachedSignal("Smack2"):Connect(function()
if victim.Humanoid.Health > 5 then
victim.Humanoid.Health -= 5
end
weakpunch.Parent = Character.Torso
weakpunch:Play()
end)
mainanim:GetMarkerReachedSignal("Uppercut"):Connect(function()
if victim.Humanoid.Health > 5 then
victim.Humanoid.Health -= 5
end
heavypunch.Parent = Character.Torso
heavypunch:play()
end)
mainanim:GetMarkerReachedSignal("SpawnDeci"):Connect(function()
Deci.Parent = Character
end)
mainanim:GetMarkerReachedSignal("Bang"):Connect(function()
if victim.Humanoid.Health > 10 then
victim.Humanoid.Health -= 10
end
BangSound.Parent = victim.Torso
Deci.fx.Attachment.Fire:Emit(1)
Deci.fx.Attachment.Shards:Emit(1)
Deci.fx.Attachment.Shards2:Emit(1)
Deci.fx.Attachment.Smoke:Emit(1)
Deci.fx.Attachment.Sparkles:Emit(1)
BangSound:Play()
RS.Events.ShakeCamera:FireClient(Player, "Bump")
end)
mainanim:GetMarkerReachedSignal("Rack"):Connect(function()
RackSound.Parent = Character.Torso
RackSound:Play()
task.wait(0.1)
Deci.fx.shelleject:Emit(1)
end)
mainanim:GetMarkerReachedSignal("DespawnDeci"):Connect(function()
Deci:Destroy()
stepsound.Parent = Character.Torso
end)
mainanim:GetMarkerReachedSignal("Step"):Connect(function()
stepsound:Play()
end)
mainanim:GetMarkerReachedSignal("Eyes"):Connect(function()
eyesound.Parent = Character.Torso
eyesound:Play()
weld = Instance.new("Weld")
weld.Name = "DeleteMe"
weld.Part0 = Character["Right Arm"]
weld.Part1 = puncheffect
weld.Parent = Character["Right Arm"]
puncheffect.Parent = Character["Right Arm"]
puncheffect.CFrame = (Character["Right Arm"].RightGripAttachment.WorldCFrame + Vector3.new(0, 0.5, 0))
glarepos = Instance.new("Attachment")
glarepos.CFrame = script.GlarePos.Value
glarepos.Parent = Character.Head
eyeglare.Parent = glarepos
eyeglare:Emit(1)
end)
mainanim:GetMarkerReachedSignal("StrongLeft"):Connect(function()
if victim.Humanoid.Health > 10 then
victim.Humanoid.Health -= 10
else
Profile.Data.leaderstats.Kills += 1
victim.Humanoid.Health = 0
end
ultrapunch.Parent = Character.Torso
puncheffect.Shockwave:Emit(1)
victim.HumanoidRootPart.Anchored = false
RagdollHandler.Ragdoll(victim, victim.HumanoidRootPart, 5, direction, 1, true)
ultrapunch:Play()
Character["Right Arm"]:FindFirstChild("PunchEffect"):Destroy()
end)
mainanim:GetMarkerReachedSignal("RootPos"):Connect(function()
victim:FindFirstChild("inv"):Destroy()
Character:FindFirstChild("inv"):Destroy()
local resync = humanoid.Animator:LoadAnimation(script.Resync)
resync:Play()
task.wait(0.1)
humanoid.AutoRotate = true
humanoid.WalkSpeed = 16
humanoid.JumpHeight = 7.2
glarepos:Destroy()
weld:Destroy()
task.delay(2, function()
for _, v in victim:GetDescendants() do
if v:IsA("Sound") or v:IsA("ParticleEmmiter") then
v:Destroy()
end
end
for _, v in Character:GetDescendants() do
if v:IsA("Sound") or v:IsA("ParticleEmmiter") then
v:Destroy()
end
end
end)
end)
task.delay(0.5, function()
if landed then
task.delay(5.6, function()
landed = false
Player.Values.IsAttacking.Value = false
end)
else
task.delay(AttackData.Attacks[tonumber(script.Name)].AttackDuration, function()
Player.Values.IsAttacking.Value = false
end)
end
end)
task.delay(AttackData.Attacks[tonumber(script.Name)].AttackDebounce, function()
AttackDebounces[Player] = nil
end)
return true
end
else
return false
end
end
function module.Init()
AttackHitboxes = module.Modules.AttackHitboxes
RagdollHandler = module.Modules.RagdollHandler
StunHandler = module.Modules.StunModule
end
return module