I am making a game that you need to check if you have already spawned that car, meaning if you already have a car spawned, you cannot spawn it again until it is removed. How could you check and see?
Here's what I have and I know this is a terrible way of doing it.
--Made by wattleman
local serv = game.ReplicatedStorage
local cc = serv:WaitForChild("CrudCar")
function spawnNew()
cc:clone()
isOneThere()
if v == true then
else
cc.Parent = game.Workspace
cc.Position = Vector3.new(-101.356, 35.503, 131.955)
cc.Rotation = Vector3.new(-0, 0.001, 0)
end
end
function isOneThere()
local search = game.Workspace:GetChildren()
for _,v in ipairs(search) do
if v.Name == "CrudCar" then
local vs = v:WaitForChild("VehicleSeat")
if vs then
if vs.Position.Changed then
return true
else
return false
end
end
end
end
end
script.Parent.Touched:connect(spawnNew)
