Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. math.randomseed(tick())
  2. local Datastore = game:GetService("DataStoreService"):GetDataStore("PlayerData")
  3. local prefix = "|user_key|"
  4.  
  5. game.Players.PlayerAdded:Connect((function(player)
  6.     local stats = Instance.new("Folder", player)
  7.     stats.Name = "Stats"
  8.     --
  9.     local family = Instance.new("StringValue", stats)
  10.     family.Name = "Family"
  11.     family.Value = "None"
  12.     --
  13.     local function RFamily(FamilyRarity)
  14.         local Irregulars = {"Nameless", "Zahard"}
  15.         local GreatFamilies = {"Ari","Arie","Eurasia","Ha","Hendo Lok","Koon","Lo Po Bia","Po Bidau","Tu Perie","Yeon"}
  16.         local SpecialFamilies = {"Blitz","Grand","Edrok","Mule","Nissam","Jaina"}
  17.         local NormalFamilies = {"Buelsar","Chang","Hong","Juglom","Nare","Hatchid","Yeo","Mei","Faker","Fodder","Nya","Red","Kang","Hyun","Royal"}
  18.         local FamiliesHolder = {"Irregulars","GreatFamilies","SpecialFamilies","NormalFamilies"}
  19.         local function FRChooser()
  20.              for i,v in pairs(FamiliesHolder) do
  21.                 math.random(1,#FamiliesHolder)
  22.                 if FamiliesHolder == 1 then
  23.                     print("Irregulars")
  24.                 elseif FamiliesHolder == 2 then
  25.                     print("GreatFamilies")
  26.                 elseif FamiliesHolder == 3 then
  27.                     print("SpecialFamilies")
  28.                 elseif FamiliesHolder == 4 then
  29.                     print("NormalFamilies")
  30.                 end
  31.             end
  32.         end
  33.         local function RandomTable(TableFamily)
  34.             return TableFamily[math.random(#TableFamily)]
  35.         end
  36.         if FamilyRarity == "Irregulars" then
  37.             return RandomTable(Irregulars)
  38.         end
  39.         if FamilyRarity == "GreatFamilies" then
  40.             return RandomTable(GreatFamilies)
  41.         end
  42.         if FamilyRarity == "SpecialFamilies" then
  43.             return RandomTable(SpecialFamilies)
  44.         end
  45.         if FamilyRarity == "NormalFamilies" then
  46.             return RandomTable(NormalFamilies)
  47.         end    
  48.         family.Value = TableFamily
  49.         end
  50.  
  51.     local Save = Datastore:GetAsync(prefix .. tostring(player.UserId))
  52.     if Save then
  53.         family.Value = Save[1] or "None"
  54.     end
  55.    
  56.     game.Players.PlayerRemoving:Connect(function(player)
  57.         Datastore:SetAsync(prefix .. tostring(player.UserId), {
  58.             player.Stats.Family.Value
  59.         })
  60.     end)
  61. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement