Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
wswswff 39
2 years 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
manith513 121
2 years ago

Try doing if keyframename.Name == "HandsOut"

Ad
Log in to vote
0
Answered by
NykoVania 231 Moderation Voter
2 years ago
Edited 2 years 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