Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I dont know how to make a spawning platform that will delete a car in its spawn location?

Asked by 5 years ago

I have got how to spawn the vehicle, but I need to be able for it to delete any car(s) in the spawning area.

script.Parent.MouseButton1Click:connect(function(Spawncar)
        Model = game.ServerStorage.CAR   
        clone = Model:clone()
        clone.Parent = workspace
        clone:MakeJoints()
end)

1 answer

Log in to vote
0
Answered by 5 years ago

The car will spawn then delete itself. Vehicles on the spawn area will not get deleted unless they are MOVING.

script.Parent.MouseButton1Click:connect(function(Spawncar)
local spawnarea = workspace.SpawnArea -- The part the car is on, the spawn area
spawnarea.Touched:connect(function(hit)
    if hit.Parent.Name == "CAR" then
        hit.Parent:Remove() -- removes the model
       elseif hit.Parent.Parent.Name == "CAR" then -- Just in case there is a model in your car
       hit.Parent.Parent:Remove() -- Removes the model
end
end)
wait(1)
        Model = game.ServerStorage.CAR   
       clone = Model:clone()
        clone.Parent = workspace
        clone:MakeJoints()

end)
Ad

Answer this question