GENERATE STOP (main code)
function mainModule.GenerateStop()
local possibleStops = RSStopStorage:GetChildren()
local randomStop = possibleStops[math.random(1, #possibleStops)]
local newStop = randomStop:Clone()
newStop.Parent = WSStopStorage
mainModule.TweenGlass(1, MainSubway.LeftDoor.Glass, Color3.fromRGB(152, 194, 219), 0.75)
mainModule.TweenGlass(1, MainSubway.RightDoor.Glass, Color3.fromRGB(152, 194, 219), 0.75)
task.wait(1)
mainModule.TweenDoors(1, MainSubway.LeftDoorOutDestination, MainSubway.LeftDoor.Door)
mainModule.TweenDoors(1, MainSubway.RightDoorOutDestination, MainSubway.RightDoor.Door)
Values.Stops.Value += 1
Values.AtStop.Value = true
end
DESTROY THE CHILDREN / THE LOOP
BE.EndedStop.Event:Connect(function()
MainModule.TweenDoors(1, MainSubway.LeftDoorInDestination, MainSubway.LeftDoor.Door)
MainModule.TweenDoors(1, MainSubway.RightDoorInDestination, MainSubway.RightDoor.Door)
task.wait(1)
MainModule.TweenGlass(1, MainSubway.LeftDoor.Glass, Color3.fromRGB(18, 28, 35), 0)
MainModule.TweenGlass(1, MainSubway.RightDoor.Glass, Color3.fromRGB(18, 28, 35), 0)
task.wait(1)
WSStopStorage:ClearAllChildren()
for i = 5, 0, -1 do
MainSubway.TimeTillStop.MainText.SurfaceGui.TextLabel.Text = tostring(i)
task.wait(1)
end
MainModule.GenerateStop()
end)
I want to make it so that when randomStop
gets chosen, I don’t want the chance of it being the previous stop.
(hopefully that makes sense)
Any help is appreciated!