1. local SelectedPlayer = "Player3" -- This is which side of the machine you're on
  2. local path = workspace.Machines.MemoryRoyale -- Path to the machine
  3. local cooldown = 0.3 -- The higher the cooldown the more likely it is to be solved with no error
  4. local rawValues = {}
  5. for _, child in ipairs(path.Patterns[SelectedPlayer]:GetChildren()) do
  6. local name = tonumber(child.Name)
  7. if name then
  8. local value = child.Value
  9. table.insert(rawValues, { name = "Button" .. tostring(name), value = value })
  10. end
  11. end
  12. table.sort(rawValues, function(a, b)
  13. return a.name < b.name
  14. end)
  15. for index, data in ipairs(rawValues) do
  16. local buttonToClick = path[SelectedPlayer].Buttons["Button" .. tostring(data.value)]
  17. if buttonToClick then
  18. local clickDetector = buttonToClick:FindFirstChild("ClickDetector")
  19. if clickDetector then
  20. task.wait(cooldown)
  21. fireclickdetector(clickDetector)
  22. end
  23. end
  24. end