Clone() Not working

Hello everyone! I am currently making a project where you press a button and clone papers, Using a button, And then you pick it up, And they have different rarities and qualities!

For some reason, When I pick it up, And press the button again, It then unequipped my item, And spawned it infront of me. It also never clones another object, Just unequipped mine. (The object is a tool, Its equippable and unequipabble)

Here is the code:

Object = game.ReplicatedStorage.Paper
Click = script.Parent.ClickDetector
Button = script.Parent
Sound = script.Printer
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.3, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)

function onClicked(playerWhoClicked) -- This function says when the part is clicked, it plays whatever sound
	Click.MaxActivationDistance = nil
	script.Parent.BrickColor = BrickColor.new("Really red")
	Sound:Play()
	script.Parent.Parent.Parent.screen.Part.SurfaceGui.SIGN.Text = "Printing"
	local tween = TweenService:Create(Button, tweenInfo, {Position = Vector3.new(-14.166, 3.135, -22.403)})
	tween:Play()
	wait(0.6)
	tween:Cancel() -- cancel the animation after 10 seconds
	script.Parent.Parent.Parent.screen.Part.SurfaceGui.SIGN.Text = "Printing."
	wait(0.5)
	script.Parent.Parent.Parent.screen.Part.SurfaceGui.SIGN.Text = "Printing.."
	wait(0.5)
	script.Parent.Parent.Parent.screen.Part.SurfaceGui.SIGN.Text = "Printing..."
	wait(0.5)
	script.Parent.BrickColor = BrickColor.new("Lime green")
	Click.MaxActivationDistance = 32
    script.Parent.Parent.Parent.screen.Part.SurfaceGui.SIGN.Text = "Done!"
	wait(0.5)

	script.Parent.Parent.Parent.screen.Part.SurfaceGui.SIGN.Text = "Press the button."
	Object:Clone()
	Object.Parent = game.Workspace
	Object.Position = Vector3.new(-15.175, 2.281, -18.514)
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

This code fetches the object paper, from replicated storage and clones it in workspace. For some reason im able to pick it up, And when I press the button again it unequipped it and put it close infront of me. (This is a tool)

I’d suggest putting the “Object” Variable inside the function thus creating new ones.
If that does not work, it should be a problem with the tweening and positioning of the object.

1 Like

Make sure the paper tool and all it’s descendants have archivable set to true.

1 Like

This clones the object, But once its cloned, If you press it again it does nothing, No unequipping, No equipping, No spawning paper, it just turns into a button.

Also the tweening is only for the button to go down and up once pressed (An effect)

Everything in the paper tool, Including the handle and its children has archivable to true.

Is Object a tool? Or a part, as you put position as a property of “Object”

1 Like

Lmao I just noticed the issue


	local newObject = Object:Clone()
	newObject.Parent = game.Workspace
	newObject.Position = Vector3.new(-15.175, 2.281, -18.514)

You are just moving the original object around

1 Like

The object is a tool. Sorry for confusion, its like this: tool - handle - children

Where do I put the new code? Thanks for your help

Replace your three lines with my three lines

1 Like