Hey im looking for a way to clone a table that has a bunch of apples in it from Replicated Storage to workspace but i cant find a way to clone them so ive only cloned one apple to work can anyone help?
for more detail, i have a folder in Replicated storage and in that folder i have a bunch of apples in it. Originally i wanted to clone the whole folder and add it to workspace but ran into issues, so i gave up and only cloned one. Can anyone help me clone evreything in the folder and make it do what i have this one Apple do?
I also renamed the AppleClone to Apple1 so it would be diffrent so i can clone it because every other fruit in the folder is called apple
local RS = game:GetService("ReplicatedStorage")
local Apple = RS.AppleTreeFruits.GoldenApple1
local AppleTree = game.Workspace.AppleTree
local AppleClone = Apple:Clone()
wait(1)
local function CloneFunction()
Apple.Parent = workspace.AppleTree.Fruits
Apple.Handle.Anchored = true
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
Apple.Handle.Anchored = false
end
end
Apple.Handle.Touched:Connect(PlayerTouched)
--wait(5) -- Testing wait --
task.wait(60)
Apple.Handle.Anchored = false
local Pickedup = false
task.wait(1)
while Apple.Parent == workspace do
task.wait(25)
--wait(3) -- Testing wait --
Pickedup = false
Apple:Destroy()
if Apple.Parent ~= workspace then
Pickedup = true
return end
end
end
CloneFunction()
I basically took your code and put it in for loop
for it to work (maybe) you have to put a table with objects in it (you can just do “path:GetChildren()”)
Since you said that it is in replicated storage, then put a path to folder in replicated storage and add :GetChildren()
And it should work
Would have to :Clone() apple since all apples will by time end
You said you want clone a table but you clone apples so I cant really know xd
for index, Apple in pairs(Put a table in here) do
Apple.Parent = workspace.AppleTree.Fruits
Apple.Handle.Anchored = true
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
Apple.Handle.Anchored = false
end
end
Apple.Handle.Touched:Connect(PlayerTouched)
--wait(5) -- Testing wait --
task.wait(60)
Apple.Handle.Anchored = false
local Pickedup = false
task.wait(1)
while Apple.Parent == workspace do
task.wait(25)
--wait(3) -- Testing wait --
Pickedup = false
Apple:Destroy()
if Apple.Parent ~= workspace then
Pickedup = true
return end
end
end
yeah i only cloned apple so i can get the code to work. but i couldnt clone a table so i just made one apple work so i can make every other fruit in the Replicated folder work (i made one apple work just to pass the time and so i would have the outline of what i wanted to do with everything in the folder