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

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

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)

3 comments

0

check that the code runs by adding in prints

0

i did

0

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

1 answer

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 =)

1 comment

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

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