#traffic light

1 messages · Page 1 of 1 (latest)

opal python
#

local TweenService = game:GetService("TweenService")
local TrafficLightModel = script.Parent

local Lights = TrafficLightModel:WaitForChild("Lights")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true)

-- Positions for the traffic light states
local positions = {
Red = Vector3.new(-25.378, 25.933, 41.431),
Yellow = Vector3.new(-25.378, 27.93, 41.431),
Green = Vector3.new(-25.378, 29.866, 41.431)
}

-- Helper function to move the light to a given position
local function moveLightToPosition(lightName, position)
local light = Lights:FindFirstChild(lightName)
if light then
local tween = TweenService:Create(light, tweenInfo, { Position = position })
tween:Play()
end
end

-- Loop forever to cycle the lights
while true do
-- Move Green light
moveLightToPosition("1", positions.Green)
wait(4)

-- Move Yellow light
moveLightToPosition("2", positions.Yellow)
wait(1)

-- Move Red light
moveLightToPosition("3", positions.Red)
wait(4)

end

sleek smelt
#

@opal python Are you wanting it to be done on a timer?

opal python
sleek smelt
#

Ok,