What do you want to achieve? I want my sword running animation to set Speed to 0 when it reaches the keyframe
What is the issue? The issue is that it is not adjusting speed at all without error but it’s still printing at the end
What solutions have you tried so far? I’ve looked for solutions but none have helped. I’ve tried other keyframes to freeze on too
game:GetService("ReplicatedStorage").Events.RunEquip.OnClientEvent:Connect(function(action)
if action == "Running" then
if Equipped == true then
RunAnim.Priority = Enum.AnimationPriority.Movement
RunAnim:Play()
RunAnim.KeyframeReached:Connect(function(name)
if name == "Hold2" then
RunAnim:AdjustSpeed(0)
print "adjsuted"
end
end)
end
end
end)
Which nested connections? and also my problem was that the animation doesn’t freeze even when I adjust the speed to 0. I already tried it and for some reason it’s not working but not producing errors either
Edit: Im a little stupid, I know what you mean by nested connections now, but what is a better alternative?
if action == "Running" then
if Equipped == true then
RunAnim.Priority = Enum.AnimationPriority.Movement
RunAnim:Play()
local keyframeConnection --the variable that will hold the connection
keyframeConnection = RunAnim.KeyframeReached:Connect(function(name)
if name == "Hold2" then
RunAnim:AdjustSpeed(0)
print("adjsuted")
keyframeConnection = keyframeConnection and keyframeConnection:Disconnect() --checking if the connection exists then disconnects it
end
end)
end
end