PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

RemoveKeyframe

This function removes a Keyframe from the KeyframeSequence by setting its parent to nil. It is functionally identical to setting the keyframe’s parent to nil

The Keyframe's parent is set to nil, but it is not destroyed. This means, provided the keyframe is referenced it can be re-parented later.

Note, this function will not error when an Instance other than a Keyframe is given as the keyframe parameter.

Parameters

Name Type Default Description

The Keyframe to be removed.

Returns

Return Type Summary

Code Samples


KeyframeSequence RemoveKeyframe

This sample adds a Keyframe to a KeyframeSequence before removing it and adding it again. Note that once a Keyframe is removed it is not destroyed, meaning it can be re-added later.

-- create the keyframesequence
local keyframeSequence = Instance.new("KeyframeSequence")
keyframeSequence.Parent = workspace 

-- create a keyframe
local keyframe = Instance.new("Keyframe")

-- add the keyframe 
keyframeSequence:AddKeyframe(keyframe)

wait(2)

-- remove the keyframe 
keyframeSequence:AddKeyframe(keyframe)