In terms of running in studio you can use this InStudioMode
for play solo you will need to look at the network replicators as playing solo does not create these.
for the test server look for replicators as they are needed.
Hope this helps.
Edit:-
01 | local isStudio = UserSettings().GameSettings:InStudioMode() |
04 | if UserSettings().GameSettings:InStudioMode() then |
05 | print ( 'you are in studio' ) |
07 | print ( 'you are not in studio' ) |
10 | local NetworkServer = game:GetService( 'NetworkServer' ) |
12 | print ( 'running server' ) |
14 | print ( 'not running server' ) |
This only shows the basics of how it would work.