Log in to vote

how do i make a clone of a part from replicated storage to workspace in a certain position?

Asked by 3 days ago

I'm a beginner and i don't really understand some of the other script things but I tried making my own script so that I could learn but it didn't work :(

my script:

local click = script.Parent local button = script.Parent local block = game.ReplicatedStorage.test

click.MouseClick:Connect(function() block = block:Clone() --clones block block.parent = game.Workspace -- clone transfers to the workspace block.Position =, 38.673, -244.463) --puts it to the location end)

Can you put your code in a code block. MarkedTomato 620 — 3d

2 answers

Log in to vote
Answered by 3 days ago
Edited 3 days ago


  1. You should always use :GetService even if you can define the service from the DataModel. Why? Because :GetService can still retrieve the service even if you were to change the name. The workspace is different, there's a global variable known as Workspace or workspace.

  2. You should change the properties of an instance first, then the last thing you should do is parent it, this can increase the performance of your game.

Fixed Script

local click = script.Parent 
local block = game:GetService("ReplicatedStorage").test

   local cloneBlock = block:Clone()
   cloneBlock .Position =, 38.673, -244.463) 
   cloneBlock .Parent = workspace 


Removed the button variable because you had two variables that had the same value.

From my POV, the click variable is a ClickDetector. The MouseClick event of the ClickDetector has a parameter which is the PlayerThatClicked.

So, after that, I created a variable for that the cloned Instance. Usually, when I just want to parent it to the workspace, I would do block:Clone().Parent = workspace I would do it in one line, but for this case, you want to change the position so, you have to create a variable.

Then, the last are changing the Position and parenting it.

Also, I'm confused why you created variables that had the same value.

Ay man they said they were a beginner bro take it easy and don't use such big words 25MouseSensitivity 38 — 3d
Log in to vote
Answered by 3 days ago
Edited 3 days ago

Alright So I Just Made A Few Fixes But Here You Go:

-- // Variables
local Click = script.Parent 
local Block = game.ReplicatedStorage:WaitForChild('test')

local Position =, 38.673, -244.463)

local function PlaceMent()
  Block2 = Block:Clone()
  Block2.parent = game.Workspace
  Block.Position =  Position


Answer this question