Put simply, I’m trying to update my train traffic signal system and it has been working fine.
However, upon modifying an existing function to be formatted slightly differently so I could add on to it, it just stops working entirely.
I don’t spot any issues with the code, though I may be overlooking something. I added print statements to test what runs, only to find out that none of them print (besides the “child added” print occurring at start up because of the TouchInterest instance).
Please let me know if there’s something I’m doing wrong here!
Code: (comment is old function, new function is above)
--*GT1
local function Countdown()
print("count down 2")
task.wait(0.1)
if (child.PrevSensor.Value:FindFirstChild("OccupiedBy") ~= nil) and (child.TimerActive.Value == true) then
print("yea")
child.Countdown.Value = child.TimerLength.Value
end
end
child.PrevSensor.Value.ChildAdded:Connect(function(added)
print("child added")
if added.Name == "OccupiedBy" then
print("count down 1")
Countdown()
end
end)
child.TimerActive:GetPropertyChangedSignal("Value"):Connect(Countdown)
--[[child.PrevSensor.Value.ChildAdded:Connect(function(added)
task.wait(0.1)
if (added.Name == "OccupiedBy") and (child.TimerActive.Value == true) then
child.Countdown.Value = child.TimerLength.Value
end
end)]]