So I’m trying to make a script where it finds the position of a part when an animation is playing, but it seems that .KeyframeReached is not working.
I tried a forum that a roblox staff member replied to and his script worked for a little bit and then it broke when I went back to it.
Here is the script I am using.
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(KeyCode)
KeyCode = KeyCode.KeyCode
if (KeyCode == Enum.KeyCode.E) then
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://5799073368"
local Character = script.Parent
local Humanoid = Character.Humanoid
local AnimTrack = Humanoid:LoadAnimation(Animation)
AnimTrack.KeyframeReached:Connect(function(Name)
print("Keyframe: " .. Name)
end)
AnimTrack:Play()
end
end)
Here is a video of my problem.
[https://youtu.be/TOxijT5Y-us]