Creating A Basic Skill Tree

Hello! This Is A Skill Tree Tutorial. This is my first tutorial, so point out anything that I can make better!

Things you need to understand:

  • Luau (Roblox Lua)
  • GUI

Step 1: Creating The GUI
So, This Step Is The Easiest, Just Make Your GUI!

Insert A ScreenGUI:
image_2021-05-24_152057

Insert a Frame:
image_2021-05-24_152306

Make Your GUI Look As You Want, But Put There The Gun For The Sake Of This Tutorial And Then Go To Step 2!
Now Set The position Of The Frame To {0.5,-25},{0.5, -25}
Anchor Point To 0.5, 0.5

I Made It Look Like This:

Step: 2 Coding The Gun Button
So, Now That We Have The GUI Out Of Our Way, For Now, We Are Going To Make The Buttons Work.

Make A LocalScript In The Button:
image_2021-05-24_160058

We’ll Make Some Variables:

local Player = local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui.Tree

Now It’s Time To Make Some Real Code. But First, Make A SkillPoint Value:
Go To Your Frame, And Insert A NumberValue, Call It “Points”
Set It Value To The Skill Points You Want At The Start.

Now, I Assume You Are Doing A Gun Like Me, So Put Your Tool In ReplicatedStorage.
You Can Make The RS Variable:

local ReplicatedStorage = game.ReplicatedStorage

Put Your Gun There, And Write This Code (My Gun Is Handgun, so change it to your gun name):

local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui.Tree

GUI.Frame.GunButton.MouseButton1Click:Connect(function()
		
if GUI.Frame.Points.Value > 0 then
		local Gun = game.ReplicatedStorage.Handgun:Clone()
		
		Gun.Parent = Player.Backpack
		GUI.Frame.Points.Value = GUI.Frame.Points.Value - 1
		script:Destroy()
	end
end)

And You Have The Button For Guns!

Step 3: Coding The Speed Button
This One Is Straight Foward, Just Write This In The LocalScript in The Speed Button:

local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui.Tree

script.Parent.MouseButton1Click:Connect(function()
	

if GUI.Frame.Points.Value > 0 then
		Player.Character.Humanoid.WalkSpeed = 40
	GUI.Frame.Points.Value = GUI.Frame.Points.Value - 1
script:Destroy()
	end
end)

We Also Don’t Want People To Get The Speed Button Without Getting The Gun Button, So We Are Going To Make An if Statement For It. The Final Code Is This (Change The Value In The Code To The Name Of Your Value):
GunButton:

local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui.Tree

GUI.Frame.GunButton.MouseButton1Click:Connect(function()
		
	if GUI.Frame.Points.Value > 0 and GUI.Frame.GunButton.Value == false and GUI.Frame.SpeedButton.Value == false then
		local Gun = game.ReplicatedStorage.Handgun:Clone()
		
		Gun.Parent = Player.Backpack
		GUI.Frame.Points.Value = GUI.Frame.Points.Value - 1
		script:Destroy()
		GUI.Frame.SpeedButton.Value = true 
	end
end)

SpeedButton:

local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui.Tree

script.Parent.MouseButton1Click:Connect(function()
	

	if GUI.Frame.Points.Value > 0 and GUI.Frame.GunButton.Value == false then
			Player.Character.Humanoid.WalkSpeed = 40
			GUI.Frame.Points.Value = GUI.Frame.Points.Value - 1
			GUI.Frame.GunButton.Value = true
	end
	end)

So, That Was The Tutorial, Point Out Any Errors And I’ll Try My Best To Fix Them!

Buh Bye!

WORKING ON THE FE PART, SO DON’T WRITE IT IN THE COMMENTS!
Thank You!

14 Likes

While I like the concept, this tutorial does not account for filtering enabled. Which means that when you subtract players coins, the change won’t be seen on the server or by other players. Additionally, the weapon that you give the player won’t replicate for other players.

For this kind of stuff, you really need to use remote functions or events. They are the standard these days.

7 Likes

Ah, God, I Am So Sorry, I’ll Try To Fix It In Several Days.

3 Likes

Here’s a few nitpicks.

  1. Roblox lua is called Luau

  2. You want to avoid shortening variable names because it hurts readability. So ideally you should rename RS to just ReplicatedStorage

  3. Maybe not place local scripts all over your UI?
    This is usually a really bad solution because if you want to change how your buttons work you’ll have to go through all your scripts.

It’ll probably be better if you just use one script and organize your UI using modules.

4 Likes

Thanks, There Will be More, For Example, FE. I need Some Days As I have Some Other Things To Do!

1 Like

For the record, capitalizing every word is very unprofessional and immature. Just thought I’d help by pointing that out, it’s not a habit you want to develop :slight_smile:

2 Likes

It’s fine if you’re using PascalCase for services and such, but @blackstrike_sk should really try to use camelCase for most of the variables.

3 Likes

I was referring to their normal typing, not code.

1 Like