-
What do you want to achieve? Keep it simple and clear!
Just need a way to break the script if an error occurs, I have a loop script that loops on forever. What this is for are rear car lights, making it so when you accelerate, lights are off. you stop driving and lights are on.
This is very simple to make but, the only issue is that. Script tries to find parent of whatever object it’s in, in this case it’s a VehicleSeat. If the script can’t do that then it will create a spam of errors. I want to break out of that error if I didn’t direct it to the parent inside the script.
while wait(0.05) do
if script.Parent.Parent.Parent.VehicleSeat.Throttle == 1 then
script.Parent.Value = false
elseif script.Parent.Parent.Parent.VehicleSeat.Throttle == 0 then
script.Parent.Value = true
elseif script.Parent.Parent.Parent.VehicleSeat.Throttle == -1 then
script.Parent.Value = false
end
end
Would there be a way to break out the script if the parent is not set to the VehicleSeat?
Do not write entire scripts or design entire systems.