Detect when started play test with play here

I would like to know preferably in a local script if I had started a playtest with the play here button. How do I do this? I tried using IsStudio() but it’s true when I run a playtest normally and with the play here button.

this would help you
RunService:IsEdit
RunService:IsRunning

1 Like

You could create a “defaultPosition” variable that basically stores where the player would normally spawn, and check if the character’s humanoidRootPart is at or near that position upon joining the game.

If they are, you probably joined through the regular playtest button, if not, you probably joined through the “Play Here” button.

3 Likes

Those functions don’t detect when the “Play” button has been pressed and the “Play Here” button has been pressed. They only detect whether studio is in Edit mode, or if the developer is PlayTesting.

1 Like

Thanks, that worked. I had to change it up a little bit for it to work, however.

local default = Vector3.new(0,script.Parent.HumanoidRootPart.Position.Y,0)

if (script.Parent.HumanoidRootPart.Position - default).Magnitude < 15 then

script.Parent:SetPrimaryPartCFrame(workspace.SPAWNS[game.Players.LocalPlayer.Spawnpoint.Value]:GetPivot())

end
1 Like

IsRunning detects when the Player Is currently playing in studio and not in edit mode.

1 Like

That’s not what he wanted an answer for, he wanted an answer on whether he clicked the “Play” button in studio, or the “Play Here” button in studio.

1 Like