How to make a "Press any key to continue" starting menu

Hello fellow developers! Figured this was pretty simple and might help someone so I hopped on and decided to write it, enjoy and report any bugs or anything of the sort in the replies!

Actual loading screen API overview: Devforum API page

First youā€™ll need the tell roblox to disable the default loading menu, and that can be done simply with a LocalScript in ReplicatedFirst with a few lines

local ReplicatedFirst = game:GetService("ReplicatedFirst")

ReplicatedFirst:RemoveDefaultLoadingScreen()

Next weā€™ll setup the GUIā€™s needed for the menu, a StarterGui, a Frame, and a TextLabel (I prefer to name all my instances but it doesnt matter much for the sake of this tutorial)
You will want to set the Frameā€™s Size to ā€œ{1, 0},{1, 0}ā€ so that it fits the entire screen, and the TextLabelā€™s Position to ā€œ{0.4, 0},{0.85, 0}ā€ (This doesnt really matter, just put it where ever you want it on the Frame)

And then you can mess around with colors and the properties of the Frame & TextLabel to fit your game or whatever you want, and you should eventually end up with something resembling this


2021-12-25 10_03_24-Window

Now onto the code:

Main API being used: Devforum UserInputService Page
(UserInputService will now be referenced to as ā€œUISā€)

Now we can make a LocalScript under the TextLabel
2021-12-25 10_05_29-Window
And for code its pretty simple, when the player loads we will disable their controls, we will detect when UIS detects an input, check if its a keyboard, if it is, then we turn the GUI off and enable their controls so they can enjoy your game

And the code is pretty basic, comments should explain everything, leave a reply if you need help or are confused with anything!

local UIS = game:GetService("UserInputService") --UserInputService used for detecting inputs sent from the player
local ScreenGui = script.Parent.Parent.Parent --The GUI we will disable when the player enters an input
local Player = game:GetService("Players").LocalPlayer --The player (client) that we need to disable & enabled the controls from
local Character = Player.Character or Player.CharacterAdded:Wait() --The physical character that everyone in the game can see
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls() --Gets the roblox controls module so we can :Eanble() and :Disable() their movement controls
Controls:Disable() --Disable the players movement controls when the player joins the game
ScreenGui.Enabled = true --Making sure that the GUI is enabled and able to be viewed when the player joins the game

UIS.InputBegan:Connect(function(input) --.InputBegan is when you press a key, move your mouse, or even press a button on your VR/Xbox controller
	if input.UserInputType == Enum.UserInputType.Keyboard then --If the input is a Key, which means they pressed a key on their Keyboard
		ScreenGui.Enabled = false --Disables the GUI so they can see the game
		Controls:Enable() --Enables their controls so they can move around and play the game
	end
end)

Have a good holiday everyone!

Edits will be spelling & grammer corrections, along with bugs and/or optimizations

Edit one: Typos and downloadable place:TheBaconHero_101's Place Number: 88 - Roblox - If this gets enough attention ill make a tutorial on how to make a keybind editor with data saving

23 Likes

Had no clue Controls:Disable() existed. Thanks so much and merry Christmas!

9 Likes

Felt like doing it so I made the keybind tutorial :smiley:

3 Likes

What happens if someone joins on mobile or Xbox? I donā€™t really use UIS that much

You should add a GUI button for mobile, and for Xbox you can add an ā€œelseā€ if you want Xbox & PC, then you can use Xbox inputs (never programmed with Xbox controls, Iā€™ll look more into this)

Just did some more searching and found this, I would use this instead of .Keyboard if you want Xbox support! UserInputService | Roblox Creator Documentation

If you are doing something like this you should be manually loading the player using ā€œCharacterAutoLoadsā€ instead of using Controls:Disable(). It all depends on your use case of course.

I found it easier to use Controls:Disable() because its what I knew and ive never used :CharacterAutoLoads, and its taken from my projects where the character loads in a lobby space

1 Like