Hello! In this tutorial, you will learn:
- how to get Roblox Studio
- get familiar with the controls
- about ProximityPrompts
- some scripting
- how to spawn a part at a specific location
- how to clear all items in a specific folder
You don’t need any scripting knowledge in order to follow this tutorial.
So, let’s get started!
Step 1 - Download and log into Roblox Studio
Most people here may already have it installed, but I am adding this step just in case you haven’t. If you already installed Studio and have your game open right now, skip to Step 3.
Start by going to create.roblox.com, and on your left you will see a section that says Resources. Under there, click “Download Studio” and run the application.
If all goes well, you should have Studio installed onto your computer. When you launch it, log in with your credentials, and you will be on the Home screen.
Congratulations, you just installed Roblox Studio, and you can now start making your own games!
Step 2 - Create a game
Now that you have the necessary programs installed, let’s create probably your first game!
- If not open already, open up Studio. You most likely won’t need to log in again.
- Go to New and click on Baseplate or Flat Terrain.
How do I know which one is right for me?
If you want to add realistic-looking grass and terrain with the Terrain editor, I suggest you should go with Flat Terrain. Otherwise, choose Baseplate. Note that the template that you choose does not affect the tutorial in any way.
- Click File > Save To Roblox and follow the on-screen instructions to give a name and description to your game.
Now, when you need to close Studio for something, you can find your game via the My Games section on the Home screen.
Step 3 - Setting up
If this did not work for you or if there were any technical issues during the process, follow this tutorial. If you feel that you need more time to become familiar with the program, then follow this tutorial.
Alright, now that you have learned the basics, we can finally start preparing our game.
- Make sure that both the Explorer and Properties windows are open. If they are not, navigate to the View tab in the game and click Explorer and Properties to open them.
- In the Explorer, right click on Workspace and click Insert Object. Then, search for Folder. When it is inserted, right click it, then click Rename. Name your folder “CurrentlySpawnedParts” without quotes.
- Do the same thing above, except insert a Part into the Workspace and name it “PartSpawner” without quotes.
- Do the same thing above, except insert a ProximityPrompt into “PartSpawner”. Leave the name alone.
- In the Properties tab, make sure the ProximityPrompt is highlighted and then do the following:
- In the ActionText property, you can name it something like “Click To Spawn”.
- In HoldDuration, if you want players to hold the prompt down to spawn a part, then set it to a value above 0. If you want players to simply click it, set it to 0.
- To avoid any errors, leave RequiresLineOfSight unchecked.
- KeyboardKeyCode is the key that players will have to hold down or press to spawn a part. Players on mobile can hold down their finger on the prompt. Console players will hold down the GamepadKeyCode button.
- To avoid autoclickers, set ClickablePrompt to be unchecked.
Step 4 - Scripting the part spawner
We are now able to script our part spawner. First, insert a Script into the ProximityPrompt and name it anything you’d like. Next, double-click the script to open the Script Editor. Erase the “print(“Hello world!”)” line of code. Then, paste the following code into the script:
local prompt = script.Parent
prompt.Triggered:Connect(function()
local spawnedPart = Instance.new('Part')
spawnedPart.Name = "SpawnedPart"
spawnedPart.Position = Vector3.new(0,1,0)
spawnedPart.Parent = game.Workspace.CurrentlySpawnedParts
end)
The code explained: When the ProximityPrompt is triggered, we will spawn a part at 0,1,0 in the Workspace’s CurrentlySpawnedParts folder you just created.
Now test the game, and make sure it works!
Warning: Make sure that the script is not a LocalScript or a ModuleScript, otherwise it will NOT work.
Step 5 - Safety precautions
If a player spawns too many parts in your game, the game may crash! That’s not good, so we should make sure that the player can prevent that by adding our Clear Parts prompt.
- In the Workspace, insert a Part named ClearParts.
- In the ClearParts part, insert a ProximityPrompt and do the following in the Properties window:
- In the ActionText, name it something like “Clear All Parts”.
- In the HoldDuration property, I strongly recommend that you set it to a value above 0.
- Make the KeyboardKeyCode a different key than the one you set for the SpawnParts prompt.
- Set RequiresLineOfSight to false.
- Now, insert a Script into the ClearParts prompt, delete the code inside, and paste the following code:
local prompt = script.Parent
prompt.Triggered:Connect(function()
local spawnedParts = game.Workspace.CurrentlySpawnedParts
for _, part in pairs(spawnedParts:GetChildren()) do
part:Destroy()
end
end)
Explanation: When the ClearParts prompt is triggered, we will look for all the parts we have spawned. Then, we will loop through every single part and delete it until all of the parts spawned get deleted.
Now test your game, and make sure it works!
Warning: Make sure that the script is not a LocalScript or a ModuleScript, otherwise it will NOT work.
Step 6 - Finalizing changes and advanced options
We are almost there! To save our changes and make our game public:
- Go to File > Publish to Roblox to publish your game to the platform.
- Go to Game Settings > Permissions and set it to Friends for your friends to play, or Public for the world to see.
Congratulations! You just made a game!
Wait, don’t go yet! There are still some optional things you can do!
Optional items
- In create.roblox.com, go to Creations > Experience > [your experience] and on the left, click Questionnaire. You should fill this out so more people can play your game.
- Don’t stop here! Make a map for your game that players can walk around in!
- Follow the part 2 tutorial that I may make (will put the link here if I make it)
- Create an icon, thumbnail(s) and/or even a YouTube trailer for your game in Game Settings! These elements can go a long way.
- Advertise your game!
- Find a way to monetize your game!
Leave some feedback in the comments if you want to!