Ad
Log in to vote
0

How do you detect a specific keyframe from a script in roblox studio?

Asked by
wswswff 14
16 days ago
humanim.KeyframeReached:Connect(function(keyframename)
    print(keyframename)
    if keyframename == "HandsOut" then
        local gras = script.Parent.Parent.Spawn_Grass
        local gra = gras:Clone()
        gra.Parent = workspace
        gra.Transparency = 0
        gra.Anchored = false
        gra.CanCollide = true
    end
end)

humanim is the animation, it plays but then the name checker doesn't work

2 answers

Log in to vote
0
Answered by 16 days ago

Try doing if keyframename.Name == "HandsOut"

Ad
Log in to vote
0
Answered by
NykoVania 198 Moderation Voter
16 days ago
Edited 16 days ago

Place an animation event in your animation at the keyframe u want and use GetMarkerReachedSignal

Example:

humanim:GetMarkerReachedSignal("HandsOut"):Connect(function()
      local gras = script.Parent.Parent.Spawn_Grass
        local gra = gras:Clone()
        gra.Parent = workspace
        gra.Transparency = 0
        gra.Anchored = false
        gra.CanCollide = true
end)

Answer this question