MMORPG Guides

Part 1: Values

When you first open your Baseplate you will be greeted to a blank canvas. A big factor in MMORPG games on Roblox is going to be variables and values. The first thing you are going to want to do is make your variables such as Strength,Defense,Cash,etc. You can begin this by creating a new script inside of the workspace and calling it "leaderstats." In order to create a variable you are going to use the "PlayerAdded" function by typing as follows:

----------------------------------------------------------------------------------------------------------------------------------

game.Players.PlayerAdded:Connect(function(plr) ----- This will communicate to the Roblox engine when a player joins the game.

local stats = Instance.new("Folder") ----- This will create a new folder which will store your player's stats.

stats.Name = "leaderstats" ----- This will rename the folder you just created to leaderstats.

stats.Parent = plr ----- This will put the "leaderstats" folder inside of the Player file.

local Strength = Instance.new("IntValue") ----- This will create a new variable to act as a level or experience.

Strength.Name = "Strength" ----- This will be the name of the stat you would like to implement.

Strength.Parent = stats ----- This is where the Strength stat will be created. Take note how it's transferred to the Player's stats file.

end)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This is how it should appear if done properly.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Now, we will learn how to make a part increase our stats from clicking on it. First, create a part and place it wherever you like. After the part is created insert a ClickDetector and a Script file into it.
Now open up the script file and paste as follows:

script.Parent.ClickDetector.MouseClick:Connect(function (Player) ----- Communicates with Roblox that a player has clicked.

Player.leaderstats.Strength.Value = Player.leaderstats.Strength.Value + 1 ----- Adds 1 to your current strength value

end)

Now whenever you click on this part in game your "Strength" stat will be increased by 1.

-------------------------------------------------------------------------------------------------------------------------------<-------------------------------------------------------------------------------------------------------------------------------

Now that we have a basic understanding of how values work, lets create an example of how we can use them.

First off, we are going to want to decide which value we are going to use. For learning purposes let's create a gold shop. First we will have to create a gold stat the same way that we did our strength stat so go ahead and open up your leaderstats and add as follows to it;

local Gold = Instance.new("IntValue") ----- This will create a new variable to act as gold.

Gold.Name = "Gold" ----- This will be the name of the stat you would like to implement.

Gold.Parent = stats ----- This is where the Gold stat will be created. Take note how it's transferred to the Player's stats file.

end)

So now we should have a Gold stat and your leaderstats should look like this.

Part 2: Shops And Inventory

Next, we are going to create an inventory so the shop can properly function and we can receive the items we purchase.

In order to do this, go back into your leaderstats and add another "Intvalue" by typing as follows;

local Slot1 = Instance.new("IntValue")

Slot1.Name = "Slot1"

Slot1.Parent = Player

---------------------------

Once you have that finished we are going to create an Inventory GUI.

Comments