Try defining it before playing the animation. I always do this and it worked for me
And incase KeyframeReached yields the script without indication, wrap it inside a task.spawn()
local EquipTrack = animator:LoadAnimation(EquipAnimation)
currentAnim["Equip"] = EquipTrack
EquipTrack.KeyframeReached:Connect(function(event)
print("Reached keyframe: " .. event)
if event == "Equip" then
print("Equip Keyframe Triggered")
tool.Handle.Transparency = 0
end
end)
EquipTrack:Play()
does it have to do with it being inside another connect function?
tool.Equipped:Connect(function()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator") -- Recommended for animations
-- Play Equip Animation
local EquipTrack = animator:LoadAnimation(EquipAnimation)
currentAnim["Equip"] = EquipTrack
task.spawn(function()
EquipTrack.KeyframeReached:Connect(function(event)
print("Reached keyframe: " .. event)
if event == "Equip" then
print("Equip Keyframe Triggered")
tool.Handle.Transparency = 0
end
end)
end)
EquipTrack:Play()