Is there a way to run code in all servers of a game?

I want to know how to run a script in all servers of a game, like the nuke all servers thing from The impossible obby, how do i achieve that?

Yes, it is possible with the Cross-Server Messaging service. You can take a look at it in the DevHub API Reference here.

There are two simple options, use DataStore or MessagingService:

For DataStore: configure a script every so often see if a key says to activate.

For MessagingService: if you want to do it, trigger this event from a server.