Hello I was working on my project that there are little cars that stop when there is something in front of them there is 2 script one of them controls the stop system another one moves the car
stop script :
local stopregion
while true do
wait(0)
stopregion = Region3.new(script.Parent.CheckPart1.Position, script.Parent.CheckPart2.Position)
local partsinregion = game.Workspace:FindPartsInRegion3(stopregion, nil, 100)
if #partsinregion >= 1 then
repeat
wait(0)
script.Parent.MoveCarScript.Disabled = true
wait(0)
until #partsinregion == 0
script.Parent.MoveCarScript.Disabled = false
end
wait(0)
end
move script :
while wait(0.001) do
script.Parent:SetPrimaryPartCFrame(script.Parent.CarBodyPart.CFrame + script.Parent.CarBodyPart.CFrame.lookVector * 0.05)
end
The Current Issue :
The Car Stops But It won’t Move Again And I Have NO IDEA how to fix this any help?