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

Model cloning ?

Asked by
j1011 0
9 years ago

Why my model stored on lighting is not being clone when the tree breakjoints?

hits = script.Parent.hit --This keeps track of how much "hp" the tree has left
local newtree = script.Parent:clone() --for inserting a new tree later

while true do --infinite loop
if hits.Value < 1 then --if the tree has less than 1 "hp" then
    script.Parent:BreakJoints() --make tree able to fall over. 
    game.Lighting.Wreckage:Clone()
    wait(3) --wait a while
    script.Parent:remove() --remove the tree
    wait(10) --wait a while
    newtree.Parent = game.Workspace --insert a new tree
    newtree:MakeJoints() --make tree unable to fall over
end
wait(1) --wait a while before checking trees hp again
end

1 answer

Log in to vote
4
Answered by 9 years ago

What model are you talking about? If its the Wreckage that your talking about then here's the answer.

hits = script.Parent.hit
local newtree = script.Parent:clone()

while true do
if hits.Value < 1 then
    script.Parent:BreakJoints()
    --local clone = game.ReplicatedStorage.Wreckage:Clone()
    --Pick any of these 2 to make it your storage ^ v
    local clone = game.ServerStorage.Wreckage:Clone()
    clone.Parent = game.Workspace -- this is what you forgot to put in the script
    wait(3) --wait a while
    script.Parent:Destroy()
    wait(10)
    clone:Destroy() -- Just incase if people farm the tree, the place wont be flooded with wreckages
    newtree.Parent = game.Workspace
    newtree:MakeJoints()
end
wait(1)
end

Also, why do you use the Lighting as storage? ReplicatedStorage and ServerStorage are the best storages you can find in the studio.

Double check the script, you may have forgot something, like the parenting of the Wreckage into the Workspace

I hope this works for you now, i have tested this script .

0
You can fit lines 9 and 10 together by doing this: game.ServerStorage.Wreckage:Clone().Parent = workspace. EzraNehemiah_TF2 3552 — 9y
Ad

Answer this question