Hey developers! I am currently wanting to achieve an effect where one of my rigs that has an animation is duped and the animation is playing at an old state.
This is an example from minecraft story mode (while my game has nothing to do with this, it shows this effect well):
You can see that there is a model, that is cloned and copies of it that follow it’s movement, at an older state, with the transparency of it being just a little lighter each time.
I’m not asking for you to write a script (although any code examples would be nice!) but I am asking on how I should approach this effect, as I am completely lost on how I should do this, mostly with playing an animation at an older state, and following its older movements.
after some testing, I found the solution that may be suitable for your case:
local Interval = 0.5
local CloneLifeTime = Interval * 2
local TweenService = game:GetService('TweenService')
local Character = script.Parent
local LastCharacterPivot = Character:GetPivot()
while task.wait(Interval) do
local CurrentPivot = Character:GetPivot()
-- make sure its not doing the effect while the character is in the same position as before
if LastCharacterPivot == CurrentPivot then
continue
end
Character.Archivable = true -- i use a player controlled character for this
-- clone the character reference, anchor them and pivot to the last position
local Clone = Character:Clone()
Clone.HumanoidRootPart.Anchored = true
Clone:PivotTo(LastCharacterPivot)
-- use a tween to gradually fade out the bodyparts
for _, v in Clone:GetDescendants() do -- loop through the bodyparts only
if v:IsA('BasePart') then -- BasePart can range from MeshParts, Parts, Wedges, etc
v.Transparency = 0.1 -- start from 0.1
v.CanCollide = false
local tween = TweenService:Create(v, TweenInfo.new(CloneLifeTime), {
Transparency = 1
})
tween:Play()
end
end
Clone.Parent = workspace -- parent it after all the things are done
game:GetService('Debris'):AddItem(Clone, CloneLifeTime)
Character.Archivable = false -- set the archivable property back to false
LastCharacterPivot = CurrentPivot
end
Hey, thanks so much for your reply! Just a quick question:
I see you were able to make this effect, which is awesome! However there is one part that I don’t understand doing, and thats mainly with the animation piece. Do you have any ideas for me with it. See in my case, I am making this effect not on the player but on a rig, and this rig has an animation. The animation is delayed as well as the spacing (in the example) and this is where I have my most troubles. If you could give advice on how to adress this issue, I would appreciate it! (Like how could I load the animation and then delay it on the cloned rig, because I need to load the animation on the animator before it’s used)?
I haven’t tested this yet but I figured out that I just need to do a for loop for the clones and apply a delay before playing them
local Character: Model -- the original character
local NumOfClones = 2
local DelayInbetweenClones = 0.15
local Animation: Animation -- the animation object (not the animation track)
local function PlayGhostRigs()
local AnimationTracks = {}
for i = 1, NumOfClones do
local Clone = Character:Clone() -- make sure its archivable before cloning
Clone.Parent = workspace -- apparently LoadAnimation errors when loading not in workspace
local AnimationTrack = Clone.Humanoid.Animator:LoadAnimation(Animation) -- replace Animator with the animation controller if you have a different structure
Clone.Parent = game.ReplicatedStorage -- some storage to show later on
table.insert(AnimationTracks, {AnimationTrack, Character}) -- insert the track and character
end
for _, pair in AnimationTracks do -- pair contains the track and character
task.wait(DelayInbetweenClones)
pair[2].Parent = workspace
pair[1]:Play()
-- add the debris for cleanup
end
end
this would delay the original rig animation with 2 ghost rigs with a 0.15 second delay inbetween
i don’t have enough time to finish it right now but hope it helps!