如何在 Roblox 动画的特定时间点触发事件

我正在使用 Roblox Studio,并且不知道如何在动画的特定时间点打印“test”。以下是代码:

animationTrackTwo:GetKeyframeReachedSignal("Throw"):Connect(function(value)
    print("test")
end)

local animationTrackTwo = character.Humanoid:LoadAnimation(script.Parent.ThrowSnowball)
animationTrackTwo:Play()

我认为我在动画中插入了一个名为“Throw”(可能插入得不对),但它显示“GetKeyframeReachedSignal”不是 animationTrack 的有效成员。有谁知道我做错了什么吗?

点赞
用户10823924
用户10823924

尝试使用:GetMarkerReachedSignal()函数,更多信息可在https://developer.roblox.com/en-us/api-reference/function/AnimationTrack/GetMarkerReachedSignal中找到。

2019-12-03 19:42:52