Pausing may be a feature in Roblox Studio, but is it possible in game?
A lot of developers use the pause feature in Roblox Studio when they test their game. I was wondering if it was possible to do this in the actual game. I tried
game:Pause()… Then I was out of ideas.
game:Pause did not work.
The pause feature on Roblox is… interesting. It pauses the player, but does not pause the in-game scripts. As you can see in this video, the player isn’t moving, but the random number generator is still running.
Is it possible to do this in-game? If you can, let me know in a post!
Unfortunately, you cannot pause the game via scripts with the same API that the pause button in studio uses, as you can only use it via the command bar or plugin scripts (see RunService:Pause()), forcing you to recreate it.
If you want to recreate the pause system, you’ll just need to anchor the player’s parts, then use :SetCore() to disable the reset button, as well as scripting the camera to move around freely.
That could work. I’ll get to work with that idea in a little while, thanks for the help! I’d rather wait to mark it as a solution so that I can see what other people think.
Following with what GeicoInsurance said,
I would recommend creating a button to pause and programming it to do multiple functions, like anchors the player, and disabling the reset button, and pausing the random number generator.
This does seem really intriguing.
I would set it up like this:
and write this code:
local check = script.Parent.Check.Value
script.Parent.MouseButton1Down:Connect(function() -- checks if a button has been clicked by a user
if check == true then
--whatever you want to happen here
else --if check == false then
--wharever you want to happen here, but I would reverse what you did on top
Hope you have luck with your pause button!
Edit: I would also turn the random number generator into a local part unless you want it to pause for the server.
Edit2: I always forget .Value I hope to break out of that habit soon!
This could work too! I’ve made a show game textures/hide game textures button before, so I have some experience with that. Thanks for the help, and I forget
.Value sometimes too.
If you need help, you know where to find me.
Something really weird happened…
The first time I ran the game, I was only testing the disable reset character script I couldn’t reset my character, but the second time, I got this message:
SetCore: ResetButtonCallback has not been registered by the CoreScripts
…The heck? Why did it work the first time but not the second? I’m so confused!!!
That’s because, as the error implies, ResetButtonCallback hasn’t been registered yet. You can fix it by simply wrapping it into a pcall like this:
local success = pcall(function()
You can try copy and pasting the default freecam script in studio (the one that is activated by ctrl+shift+p) and cloning it into the player from the server when you need it. It’ll make it seem more like you’re actually pausing the game like in studio.
What stumps me is that it worked the 1st time, but not the second. What’s up with that?