**script.Parent:Destroy() is not working in a script I made for cars on a highway.
This is the script that is inside of the car (Serverside not local)
local carspawns = script.Parent.Parent.Parent.Roads:WaitForChild("CarSpawns")
local car = script.Parent
local endvalue = car:WaitForChild("end")
local driving = car:WaitForChild("driving")
driving:GetPropertyChangedSignal("Value"):Connect(function()
if driving.Value == true then
for i = 0, 5, 0.001 do
car.CFrame = car.CFrame:Lerp(carspawns["Endpos"..endvalue.Value].CFrame, i)
wait()
end
script.Parent:Destroy()
end
end)
Is there anything I have to change for them to be deleted? I have tried making a part that destroys whatever touches it at the end of the highway, but that did not work either.
I just changed the increment value to a higher number. The loop ends and the parent is destroyed but now the lerp looks wicked, and the parent takes forever to get destroyed
The parent of car is script.Parent and driving is a child to car. How can this function ever return anything at all when it destroys itself internally here: