I have eight markers in my sliding animation to trigger a foot trail effect, however every time it connects it stacks over and over infinitely
(Every time the effect runs through, it outputs the floor material.)
Here’s a snippet of my code:
local marker3 = Swing3:GetMarkerReachedSignal("EffectEvent2")
Swing3:Play()
local function feettrail()
local s = raypart(RootPart)
if s~= nil then
Fire:FireServer("Elliptis","FootTrail",LeftLeg.CFrame,s.Material,s.BrickColor)
Fire:FireServer("Elliptis","FootTrail",RightLeg.CFrame,s.Material,s.BrickColor)
end
end
marker3:Connect(feettrail)
local marker3 = Swing3:GetMarkerReachedSignal("EffectEvent2")
local function feettrail()
local s = raypart(RootPart)
if s~= nil then
Fire:FireServer("Elliptis","FootTrail",LeftLeg.CFrame,s.Material,s.BrickColor)
Fire:FireServer("Elliptis","FootTrail",RightLeg.CFrame,s.Material,s.BrickColor)
end
end
marker3:Connect(feettrail)
I think it’d probably be more helpful to show more of your code, especially so it can be seen how this code is getting ran.
Realistically, you only need to call LoadAnimation once and set up your MarkerReached connections one time, so the only thing you’re doing upon reaching this sequence in an attack animation cycle is playing the animation, not also doing connections.
Furthermore, you don’t ever disconnect your connections, so understandably whenever this chunk is ran, it just keeps connecting more events.