Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why won't it dupe?

Asked by 9 years ago

When I activate this script:

local resources = game.Lighting["Iron Ore"]
local drop = true
local clone = resources:clone()
function dropfunc()
        resources:clone()
        resources.Parent = script.Parent.Parent
        wait(1)
        script.Parent.Parent["Iron Ore"].Position = script.Parent.Position
end
while drop == true do
dropfunc()
wait(10)
end

All it does is moves it to the work space and repeatedly drops it to the ground from the height of the brick. NOTE: I need to copy the whole thing because the brick contains values. I cannot just make the workspace create a new part, since it would be too complex.

2 answers

Log in to vote
2
Answered by 9 years ago

What you want to do is clone the model, and then use that as a reference for the rest of the cloned models. So essentially, every time you regenerate the model, you have to clone the backup clone and then place that in the workspace. So what you have to do is replace

resources:clone()
resources.Parent = script.Parent.Parent

With this

local Duplicate = clone:Clone() --This is cloning the "clone" that you made at the beginning of the script
Duplicate.Parent = script.Parent.Parent

Hope this helped!

Ad
Log in to vote
0
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Replace

        resources:clone()
        resources.Parent = script.Parent.Parent

with

        local clonedResources = resources:clone()
        clonedResources.Parent = script.Parent.Parent
0
Still wont work ADeadlyGuest4 62 — 9y
0
It only duplicated it from the lighting one time ADeadlyGuest4 62 — 9y

Answer this question