So I’m making a roller coaster for my park and here and there it gets stuck on the camelback hill so i decided to add a respawn button in case. I tested it and it respawned good but the second time i tried to respawn it, it said, "cart is not a valid member of Model “Workspace.Roller Coasters.mEGALODON.carmain” and I need it to where when the new cart spawns in it goes in the “carmain” model. So, I tried that, and it says nothing’s wrong with the script so what’s happening???
local cartM = script.Parent.Parent.Parent
local delaytime = .2
script.Parent.cd.MouseClick:Connect(function()
script.Parent.Parent.Parent.cart:Destroy()
wait(delaytime)
local newcart = game.ServerStorage.Regenvehicles["MEG cart"]:Clone()
newcart.Parent = workspace["Roller Coasters"].mEGALODON.carmain
end)
```
script.Parent.cd.MouseClick:Connect(function()
if cart == nil then return end
script.Parent.Parent.Parent.cart:Destroy()
wait(delaytime)
local newcart = game.ServerStorage.Regenvehicles["MEG cart"]:Clone()
newcart.Parent = workspace["Roller Coasters"].mEGALODON.carmain
end)
when i try to respawn it it says cart is not a valid member of Model “Workspace.Roller Coasters.mEGALODON.carmain… And what does nil mean and how do i check it