Can't get current studio play test mode in script!

I want to make my script stop loading the player character when I use “Play Here” in studio for easy access, but I can’t seem to find any info on ways to detect it within a script.

I’ve looked it up on the dev forum, google, and dev hub too, but it has nothing on weather or not you can tell which is being used in an active script. Here’s the link to their descriptions:
https://developer.roblox.com/en-us/articles/game-testing

If anybody has any knowledge of if this is possible or not, your advice would be greatly appreciated.

1 Like

I’m sorry I fail to understand what you are trying to say. I assume you mean you want the startercharacter to not load when you test the game in studios? If so there is no way to do that because the StarterCharacter is what each player should spawn in as and to disabling players from spawning you’ll have to do something else.

I want to know if there’s any way to see the currently used play test mode in a script when you press “Play” in studio. For example, let’s pretend that you could say something like this:

local mode = game.TestingMode

if mode == "Play" then
	print("Play")
	player:LoadCharacter()
elseif mode == "Play Here" then
	print("Play Here")
elseif mode == "Run" then
	print("Run")
end

If you don’t know what play test modes are, go into studio and click the drop down menu under the play button with the blue triangle and robloxian.

image

I understand now but now I wonder why you would want such thing. You can try using the PlayerAdded script method:

game.Players.Playeradded:connect(function)

^obv wrote wrong but it’s to give you an idea.

I want to because my game has a script that loads your character when you join the game to move you out of a loading room once your data is loaded. The reason it’s important to distinguish between the two is so that I can make it not teleport me back to the spawn when I want to spawn where my camera is in studio. Also, I already know how to tell when a player is added. :stuck_out_tongue:

You can try a loading screen because a loading screen loads and then does what ever it does after you tell it to.

I already do, and I think you’re missing the point. I simply want to know if there’s a way to tell which play test mode is currently being used in a script.

When you turn on the server, wait a sec, then check if there is a player. If there is no player, you are in run mode. When you turn on the server and there is a player, if the character spawns near a spawnlocation, they used play, if they aren’t close to one, they are in play here.

1 Like

That’s the thing :sob: I don’t know any ways that Roblox can detect if you are using each mode or not.
You could do this tho:
When you use test mode, only scripts run, the player wont spawn so you can do
print(using test mode)
when you do Play it spawns at the spawn location so maybe put a touch script in the spawn location and do
print()
and since Play Here spawns where the cam is then just do something because I have no idea :sob:

This does help and would work, thank you; Although, it would be much more efficient if there were a built-in api function to use.