This is not all the script but when a button is clicked it spawns a vehicle and a box around it (CanCollide is off). When the vehicle leaves the box, its supposed to remove the box and allow the vehicle to be regenerated. However this does not work and the box remains after the vehicle has left it (Stopped Touching it)
while Workspace:FindFirstChild("RegenSingleBox") do -- Name of box wait(1) Workspace:FindFirstChild("RegenSingleBox").TouchEnded:connect(function(NoTouch) return true end) -- If there is nothing touching the box then return true if NoTouch() == true then -- if theres nothing touching, destroy the box Workspace:FindFirstChild("RegenSingleBox"):Destroy() script.Parent.BrickColor = BrickColor.new(1031) end end
MD
EDIT: Asked on ROBLOX forums and was given a different way of solving the problem.