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)
COMMUNITY QUESTION
My cars wont spawn its errored in line 6 unknown why?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
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.
https://scriptinghelpers.org/help/how-post-good-questions-answers