I’m gonna try to make this as simple as possible.
I don’t know if any of you played Decaying Winter, but the game does have this thing called “Combo Cancel”, you have a light combo, but that requires holding left mouse button, the combo contains 3 punches, and all of those can be cancelled if LMB is not held down.
Let’s say, you let out the second punch and stopped holding LMB? The third punch won’t be released and you’ll go back to your “fighting stance”.
I’m trying to replicate that, but to be honest it’s not going well. :^)
As for the main problem, is the GetMarkerReachedSignal function, title gives it away already, so I’ll get to the point
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local comboanim = script.Parent:WaitForChild("LightCombo")
local inputuser = game:GetService("UserInputService")
local Anim = script.Parent:WaitForChild("LightCombo")
local Mouse = plr:GetMouse()
local values = {}
local track = nil
script.Parent.Activated:Connect(function()
local animator = humanoid:FindFirstChildOfClass("Animator")
if animator then
local animtrack = animator:LoadAnimation(Anim)
animtrack:Play()
end
local animationtrack = animator:LoadAnimation(Anim)
animationtrack:GetMarkerReachedSignal("afterPunch1"):Connect(function()
print("meow")
if values.Button1 then
print("works")
end
end)
end)
Mouse.Button1Down:Connect(function(input, gameProcessed)
if gameProcessed then return end
values.Button1 = true
end)
Mouse.Button1Up:Connect(function(input, gameProcessed)
if gameProcessed then return end
values.Button1 = false
end)
Everything here works just fine except for that function.
local animationtrack = animator:LoadAnimation(Anim)
animationtrack:GetMarkerReachedSignal("afterPunch1"):Connect(function()
print("meow")
if values.Button1 then
print("works")
end
end)
The meow does not get printed, there’s no error in the output, and anything past print(“meow”) doesn’t work either, and I honestly have no clue what the issue is.
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local comboanim = script.Parent:WaitForChild("LightCombo")
local inputuser = game:GetService("UserInputService")
local Anim = script.Parent:WaitForChild("LightCombo")
local Mouse = plr:GetMouse()
local values = {}
local track = nil
script.Parent.Activated:Connect(function()
local animator = humanoid:FindFirstChildOfClass("Animator")
if animator then
local animtrack = animator:LoadAnimation(Anim)
animtrack:Play()
end
local animationtrack = animator:LoadAnimation(Anim)
animationtrack:Play() -- you forgot this
animationtrack:GetMarkerReachedSignal("afterPunch1"):Connect(function()
print("meow")
if values.Button1 then
print("works")
end
end)
end)
Mouse.Button1Down:Connect(function(input, gameProcessed)
if gameProcessed then return end
values.Button1 = true
end)
Mouse.Button1Up:Connect(function(input, gameProcessed)
if gameProcessed then return end
values.Button1 = false
end)
That fixed nothing, I’m not an expert in coding but I’m pretty sure that wouldn’t do anything anyway, since I have a play in the function above.
script.Parent.Activated:Connect(function()
local animator = humanoid:FindFirstChildOfClass("Animator")
if animator then
local animtrack = animator:LoadAnimation(Anim)
animtrack:Play()
end
Have you made sure your marker is exactly called afterPunch1?
Did you try republishing the animation just in case the marker didn’t register?
I would suggest playing the animation after initializing the marker correction, like so:
animationtrack:GetMarkerReachedSignal("afterPunch1"):Connect(function()
print("meow")
if values.Button1 then
print("works")
end
end)
animationtrack:Play()
Just to make sure the event connection is initialized, before the animation is played.
So that when you play the animation, it will be triggered.