I was working on my project a few days ago then something was making me sad the bugs… yes there is a bug that makes cars standstill at the road corners here is my script
local stopregion
local partsinregion
local tweenservice = game:GetService("TweenService")
local debounce = false
local info = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local okparts = {
script.Parent.CheckPart1,
script.Parent.CheckPart2,
game.Workspace.TunnelSpawn1.CheckPart1,
game.Workspace.TunnelSpawn1.CheckPart2,
game.Workspace.TunnelSpawn2.CheckPart1,
game.Workspace.TunnelSpawn2.CheckPart2,
game.Workspace.Wedge1,
game.Workspace.Wedge2
}
while true do
wait(0)
stopregion = Region3.new(script.Parent.CheckPart1.Position, script.Parent.CheckPart2.Position)
partsinregion = game.Workspace:FindPartsInRegion3WithIgnoreList(stopregion, okparts, 100)
if #partsinregion >= 1 then
for i,v in ipairs(partsinregion) do
print(v.Name)
if v.Name == "TurnPart1" or v.Name == "TurnPart2" then
if debounce == false then
table.insert(okparts, v)
debounce = true
local tween = tweenservice:Create(script.Parent.CarBodyPart, info, {CFrame = v.CFrame})
tween:Play()
tween.Completed:Connect(function()
debounce = false
table.remove(okparts, 7)
end)
end
else
if v.Name == "Tunnel1" or v.Name == "Tunnel2" or v.Name == "Tunnel3" or v.Name == "Tunnel4" or v.Name == "Tunnel5" or v.Name == "Tunnel6" then
game.ReplicatedStorage.Happiness.Value = game.ReplicatedStorage.Happiness.Value + script.Parent.Happiness.Value
script.Parent:Destroy()
end
script.Parent.MoveCarScript.Disabled = true
script.Parent.CarBodyPart["idle car"].PlaybackSpeed = 1
repeat
wait(0)
stopregion = Region3.new(script.Parent.CheckPart1.Position, script.Parent.CheckPart2.Position)
partsinregion = game.Workspace:FindPartsInRegion3WithIgnoreList(stopregion, okparts, 100)
wait(0)
until #partsinregion == 0
script.Parent.MoveCarScript.Disabled = false
script.Parent.CarBodyPart["idle car"].PlaybackSpeed = 1.5
end
end
end
wait(0)
end
now whats the problem
when a car gets broke after it turns of a corner(car broke script) the car that is waiting for the first car to move will NEVER move until it despawn(a script that despawns cars)
Now what should i do?