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:
Insert a Frame:
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:
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!