hey guys, lately I’ve been working on M1s for my fighting game, and I’ve encountered an animation transition issue. this is what I have right now:
(Watch knife m1 showcase 2 | Streamable)
(even in this clip, u can see a little bit of overlap error)
it has to do with animations with the same animation priority overlapping on each other, and it looks rlly weird when I play 2 at once. I have read abt how to stop and transition animations, but I’m not rlly sure on how to translate that into my code that I have right now (issue shown more clearly)
(Watch knife anim issue | Streamable)
block of code
local tool = script.Parent
local handle = tool:FindFirstChild("Handle")
local player = nil
local char = nil
local humanoid = nil
local animator = nil
local m1Folder = tool:FindFirstChild("M1s")
local m1Count = 0
local m1Debounce = false
local trail = handle:FindFirstChild("Trail")
tool.Equipped:Connect(function()
char = tool.Parent
player = game.Players:GetPlayerFromCharacter(char)
humanoid = char:FindFirstChild("Humanoid")
animator = humanoid:WaitForChild("Animator")
end)
tool.Activated:Connect(function()
local m1Anims = {
[1] = animator:LoadAnimation(m1Folder:FindFirstChild("1")),
[2] = animator:LoadAnimation(m1Folder:FindFirstChild("2"))
}
--M1 logic
local m1Min = 1
local m1Max = 2
if m1Debounce then
print("debounce!")
return
end
--THIS IS THE PART FOR THE ANIMATION LOGIC
if m1Count < m1Max then
m1Count += 1
m1Anims[m1Count]:Play(0.2)
elseif m1Count == m1Max then
m1Count = 1
m1Anims[m1Count]:Play()
end
--First M1 events
m1Anims[1]:GetMarkerReachedSignal("Stun"):Connect(function()
m1Debounce = true
humanoid.WalkSpeed = 8
print("stunned!")
end)
m1Anims[1]:GetMarkerReachedSignal("Unstun"):Connect(function()
m1Debounce = false
humanoid.WalkSpeed = 16
print("unstunned!")
end)
m1Anims[1]:GetMarkerReachedSignal("TrailStart"):Connect(function()
trail.Enabled = true
end)
m1Anims[1]:GetMarkerReachedSignal("TrailEnd"):Connect(function()
trail.Enabled = false
end)
--Second M1 events
m1Anims[2]:GetMarkerReachedSignal("Stun"):Connect(function()
m1Debounce = true
humanoid.WalkSpeed = 8
print("stunned!")
end)
m1Anims[2]:GetMarkerReachedSignal("Unstun"):Connect(function()
m1Debounce = false
humanoid.WalkSpeed = 16
print("unstunned!")
end)
end)
if anybody has any solutions, please help me out! thanks