I have made a car spawner script. However, when I try to spawn the car, I Just get “TheParent Property of Body is Locked, current Parent: NULL, new parent CivCarSpawner”
https://gyazo.com/2d4587b361edd468d19131d5d7e1a979
Here is my script:
local event = script.Parent:WaitForChild("IlIlIlIlIlIlIlIlIIIIlllll")
local spawnerModel = script.Parent:WaitForChild("SpawnerModel")
event.OnServerEvent:connect(function(plr,event,arg1,arg2,arg3)
if event == "IlIlIlIlIlIlIlIlIIIIlllll" 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)
I have no idea why its not working.
If you can help thanks