Advertisement
dubleeyrblxx

Generate Stats -- Roblox

Jan 20th, 2023
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. -- you can make a gui to show all these values
  2.  
  3. game.Players.PlayerAdded:Connect(function(plr)
  4.    
  5.     local plrStats = Instance.new("Folder", plr)
  6.     plrStats.Name = "plrStats"
  7.    
  8.     local affinityTable = {"Water", "Earth", "Fire", "Air"}
  9.    
  10.     local affinityStat = Instance.new("StringValue", plrStats)
  11.     affinityStat.Name = "Affinity"
  12.    
  13.     function generateAffinity()
  14.        
  15.         return affinityTable[math.random(1,#affinityTable)]
  16.  
  17.     end
  18.  
  19.     affinityStat.Value = (generateAffinity())
  20.    
  21.     local defenceStat = Instance.new("NumberValue", plrStats)
  22.     defenceStat.Name = "Defence"
  23.     defenceStat.Value = math.random(0, 100)
  24.    
  25.     local strengthStat = Instance.new("NumberValue", plrStats)
  26.     strengthStat.Name = "Strength"
  27.     strengthStat.Value = math.random(0, 100)
  28.    
  29.     local speedStat = Instance.new("NumberValue", plrStats)
  30.     speedStat.Name = "Speed"
  31.     speedStat.Value = math.random(0, 100)
  32.    
  33.     local magicpowerStat = Instance.new("NumberValue", plrStats)
  34.     magicpowerStat.Name = "MagicPower"
  35.     magicpowerStat.Value = math.random(0, 100)
  36.    
  37.    
  38. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement