How would I go about making a cosmic clone script?

I am currently trying to create a button that when clicked will cause a changeable number of cosmic clones to spawn behind them. I want the clones to function similar to how they do in JToH. I am very lost with this and cannot even find a lead on what to do. Whenever I find something, it always leads to a dead end. I can’t find any videos or other things to help. All I am asking for is potential ideas on how to make it work. Anything helps.

I managed to make a rig copy the player’s exact movements but I have no idea how to add a delay. Can somebody help me? Here is the script

local clone = game.ReplicatedStorage.Rig:Clone()
clone.Parent = workspace
local Player = script.Parent.Parent
local Character = Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")

while true do
	clone.HumanoidRootPart.CFrame = Root.CFrame
	task.wait(0.01)
end

Boosting this because I still have not found how to delay the movement of the rig.

Boosting again as I still have not found a way to delay the movement.

If this is not possible with my current script then can you please say so and if you want you can create an example of how I would remake the current script to make it work.

You mean like this?

local clone = game.ReplicatedStorage.Rig:Clone()

local Player = script.Parent.Parent
local Character = Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
clone.Parent = workspace
print(clone.Parent)

local positionHistory = {}
local delayTime = 2 -- in seconds
local updateInterval = 0.01 -- lower = smoother




local maxHistoryLength = math.ceil(delayTime / updateInterval)

while true do
	table.insert(positionHistory, Root.CFrame)
	if #positionHistory > maxHistoryLength then
		clone.HumanoidRootPart.CFrame = positionHistory[1]
		table.remove(positionHistory, 1)
	end

	task.wait(updateInterval)
end

I figured out how to in a different post with this script:

local clone = game.ReplicatedStorage.Rig:Clone()
clone.Parent = workspace
local Player = script.Parent.Parent
local Character = Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")

While true do
     Task.Spawn(Function()
         local CRoot = Root.CFrame
         Task.wait(1)
         clone.HumanoidRootPart.CFrame = CRoot
     end)
     Task.Wait()
end

But your version is smoother and more customizable.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.