Advertisement
HowToRoblox

SkillPointsHandler

Feb 2nd, 2021
1,784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3.  
  4. local skillsFolder = plr:WaitForChild("SkillsFolder")
  5.  
  6.  
  7.  
  8. for i, skill in pairs(skillsFolder:GetChildren()) do
  9.    
  10.     if skill.Name ~= "SkillPoints" then
  11.        
  12.        
  13.         local clone = script.SkillType:Clone()
  14.        
  15.         clone.Text = skill.Name .. ": " .. skill.Value
  16.        
  17.         clone.Parent = script.Parent.SkillTypes
  18.        
  19.        
  20.         skill:GetPropertyChangedSignal("Value"):Connect(function()
  21.            
  22.             clone.Text = skill.Name .. ": " .. skill.Value
  23.         end)
  24.        
  25.        
  26.         clone.IncreaseButton.MouseButton1Click:Connect(function()
  27.            
  28.             game.ReplicatedStorage.OnPointBought:FireServer(skill.Name)
  29.         end)
  30.        
  31.        
  32.     elseif skill.Name == "SkillPoints" then
  33.        
  34.         script.Parent.PointsAmount.Text = "POINTS: " .. skill.Value
  35.        
  36.         skill:GetPropertyChangedSignal("Value"):Connect(function()
  37.  
  38.             script.Parent.PointsAmount.Text = "POINTS: " .. skill.Value
  39.         end)
  40.     end
  41. end
  42.  
  43.  
  44. script.Parent.Parent.OpenButton.MouseButton1Click:Connect(function()
  45.    
  46.     script.Parent.Visible = not script.Parent.Visible
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement