Instance doesn't clone

  1. What do you want to achieve?
    I am trying to make a looping elevator system that clones itself and moves, then it gets destroyed.

  2. What is the issue?
    So apparently it doesn’t clone. I have no idea why it’s doing that.

  3. What solutions have you tried so far?
    I have not yet tried solutions for this since the script doesn’t have any errors.

Resources:

-- Library --

local TweenService = game:GetService("TweenService")
local Lift = workspace.Lift

-- TweenInfos --

local MoveInfo = TweenInfo.new(
	
	10,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local OpacityInfo = TweenInfo.new(
	
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

-- Function --

while true do
	
	-- New Lift --
	
	local NewLift = Lift:Clone()
	NewLift.Name = "CurrentLift"
	
	-- Appear Object Info --
	
	local AppearInfo = {
		
		Transparency = 0
	}
	
	-- AppearTween --
	
	local AppearTween = TweenService:Create(NewLift, OpacityInfo, AppearInfo)
	AppearTween:Play()
	
	-- [] --
	
	wait(6)
	
	-- MoveInfo --
	
	local NewPositionInfo = {
		
		Position = NewLift.Position + Vector3.new(0, 200, 0)
	}
	
	-- MoveTween --
	
	local MoveTween = TweenService:Create(NewLift, MoveInfo, NewPositionInfo)
	MoveTween:Play()
	
	-- [] --
	
	wait(4)
	
	-- Fade Object Info --
	
	local FadeInfo = {
		
		Transparency = 1
	}
	
	-- Fade Tween --
	
	local FadeTween = TweenService:Create(NewLift, OpacityInfo, FadeInfo)
	FadeTween:Play()
	
	-- [] --
	
	wait(9)
	NewLift:Destroy()
	
end

Script

image
Workspace (LiftScript is the main script)

Thanks in advance!

1 Like

When cloning objects you also have to set their parent again so just change the lines:

local NewLift = Lift:Clone()
NewLift.Name = "CurrentLift"

to

local NewLift = Lift:Clone()
NewLift.Name = "CurrentLift"
NewLift.Parent = workspace
1 Like

It worked!

I didn’t realise that you need to set its parent to workspace because I thought it would just copy the data from the original instance to the new one.

Thank you!