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

Script that clones a model when event fired doent clone/work?

Asked by 5 years ago

i made a script that clones a model when event is fired. But it does not clone anything. No errors.

script:

game.ReplicatedStorage:WaitForChild("SpawnCar").OnServerEvent:Connect(function(player)
    for _,e in pairs(game.Workspace:GetChildren()) do
        if e.Name == player.Name.."'s Car" then
            e:Destroy()
        end
    end
    wait(0.1)
    for i,v in pairs(player:WaitForChild("SelectedCar"):GetChildren()) do
    local car = v:Clone()
    car.Parent = game.Workspace
    car:MakeJoints()
    car.Name = player.Name.."'s Car"

end
end)
0
check that the code runs by adding in prints User#5423 17 — 5y
0
i did ieatandisbaconhair 77 — 5y
0
model = game.Workspace.bacon backup = model:clone() while true do wait(8) model = backup:clone() model.Parent = game.Workspace model:MakeJoints() end pugglewugglesrepic13 -5 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

model = game.Workspace.bacon backup = model:clone() while true do wait(8) model = backup:clone() model.Parent = game.Workspace model:MakeJoints() end

that is a script to clone any objext every T seconds, just change word "bacon" to the name of the model that you are cloning and the (8) to the amount of time it should wait to regen =)

0
thanks for helping, but im trying to get the model from a folder, and not by like name. and i dont want it to regen. thanks anyways, i guess ieatandisbaconhair 77 — 5y
Ad

Answer this question