local event = script.Parent:WaitForChild("SpawnCar")
local spawnerModel = script.Parent:WaitForChild("SpawnerModel")
event.OnServerEvent:connect(function(plr,event,arg1,arg2,arg3)
	if event == "SpawnCar" then
		local inscar = game:GetService("InsertService"):LoadAsset(arg1)
--		car.Parent = spawnerModel.Value
		for i,v in pairs(inscar:GetChildren()) do
			if v:IsA("Model") then
				for _,carMod in pairs(v:GetChildren()) do
					if carMod:IsA("Model") then
						carMod.Parent = spawnerModel.Value
						carMod:MakeJoints()
						carMod:MoveTo(spawnerModel.Value:WaitForChild("SpawnPos"):GetModelCFrame().p)
						v:Destroy()
					end
				end
			end
		end
	elseif event == "DestroyGui" then
		script.Parent.Parent.Parent:Destroy()
	elseif event == "Close" then
		spawnerModel.Value:WaitForChild("Button").BrickColor = BrickColor.new("Lime green")
		spawnerModel.Value:WaitForChild("Button").InUse.Value = false
		script.Parent.Parent.Parent:Destroy()
	end
end)

2 comments

0

Just posting code and not explaining that you are doing it not a good way to post a question pls update this question to include a description of the problem.