Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesnt it copy it?

local Part = game.ReplicatedStorage.Part
local Names = {"Part", "Part2"}
Position = 84.98, 48.33, -225



for i,v in pairs(Part :GetChildren()) do
if v.Name == Names[math.random(1, #Names)] then
wait(0.1)
local Part = v:Clone()
Part .Position = Vector3.new(Position)
Part .Anchored = true
end
end


2 answers

✓ Accepted answer

You do need to parent it and tab it just like NotSoNorm said but also.. You have 2 variables called "Part"

local Part = game.ReplicatedStorage.Part --Variable called "Part"
local Names = {"Part", "Part2"}
Position = 84.98, 48.33, -225



for i,v in pairs(Part:GetChildren()) do
    if v.Name == Names[math.random(1, #Names)] then
        wait(0.1)
        local Part = v:Clone() --Variable called "Part"
        part.Parent = game.Workspace -- change game.Workspace to path
        Part.Position = Vector3.new(Position)
        Part.Anchored = true
    end
end

NotSoNorm might be right but I feel that this should not have 2 variables w/ then same name.

You have to define where it goes! It will not appear because it doesn't spawn until you parent it. (oh yeah and tab your code nob)

local Part = game.ReplicatedStorage.Part
local Names = {"Part", "Part2"}
Position = 84.98, 48.33, -225



for i,v in pairs(Part:GetChildren()) do
	if v.Name == Names[math.random(1, #Names)] then
		wait(0.1)
		local Part = v:Clone()
		part.Parent = game.Workspace -- change game.Workspace to path
		Part.Position = Vector3.new(Position)
		Part.Anchored = true
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.