Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.96 KB | None | 0 0
  1. local AssetId = "http://www.roblox.com/asset/?id="
  2. local ss = game:service("ServerStorage")
  3.  
  4. local Branches = {
  5.         ["Legion"] = {
  6.                 ["ID"] = 2527165,
  7.                 ["Hats"] = {
  8.                         ------------------------------------------
  9.                         {
  10.                                 ["Name"] = "Recruit",
  11.                                 ["RequiredRank"] = 10,
  12.                                 ["MeshId"] = 16127787,
  13.                                 ["TextureId"] = 222567180,
  14.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  15.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  16.                         },
  17.                     --
  18. {
  19.                                 ["Name"] = "Prime",
  20.                                 ["RequiredRank"] = 15,
  21.                                 ["MeshId"] = 16127787,
  22.                                 ["TextureId"] = 222567180,
  23.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  24.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  25.                         },
  26.                     --
  27. {
  28.                                 ["Name"] = "Veteran",
  29.                                 ["RequiredRank"] = 20,
  30.                                 ["MeshId"] = 16127787,
  31.                                 ["TextureId"] = 222567212,
  32.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  33.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  34.                         },
  35.                     --
  36. {
  37.                                 ["Name"] = "Vexillarius",
  38.                                 ["RequiredRank"] = 25,
  39.                                 ["MeshId"] = 55700799,
  40.                                 ["TextureId"] = 55700903,
  41.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  42.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  43.                         },
  44.                     --
  45. {
  46.                                 ["Name"] = "RecDec",
  47.                                 ["RequiredRank"] = 100,
  48.                                 ["MeshId"] = 16127787,
  49.                                 ["TextureId"] = 222567180,
  50.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  51.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  52.                         },
  53.                     --
  54. {
  55.                                 ["Name"] = "PrimeDec",
  56.                                 ["RequiredRank"] = 105,
  57.                                 ["MeshId"] = 16127787,
  58.                                 ["TextureId"] = 222567180,
  59.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  60.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  61.                         },
  62.                     --
  63. {
  64.                                 ["Name"] = "VetDec",
  65.                                 ["RequiredRank"] = 110,
  66.                                 ["MeshId"] = 16127787,
  67.                                 ["TextureId"] = 222567212,
  68.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  69.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  70.                         },
  71.                     --
  72. {
  73.                                 ["Name"] = "Centurion",
  74.                                 ["RequiredRank"] = 150,
  75.                                 ["MeshId"] = 64510477,
  76.                                 ["TextureId"] = 64510503,
  77.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  78.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  79.                         },
  80.                     --
  81.  
  82.                         -------------------------------------------
  83.                 }
  84.         },
  85. }
  86.  
  87. function GetPlayerGroupData(Player)
  88.     print("line88")
  89.     for _,v in pairs(Branches) do
  90.    
  91.         if Player.TeamColor == game.Teams["Caesar's ".._].TeamColor then
  92.             return v
  93.         end
  94.     end
  95.     return nil
  96. end
  97.  
  98. function CreateHat(Data, Character)
  99.      for i,v in pairs(Character:GetChildren()) do
  100.   if v:IsA("Hat") then
  101.    v:Destroy()
  102.   end
  103.  end
  104.     print("line98")
  105.      local Part = Instance.new("Part")
  106.      Part.Name = Data.Name
  107.      Part.Size = Vector3.new(1,1,1)
  108.    
  109.      local Mesh = Instance.new("SpecialMesh")
  110.      Mesh.MeshType = "FileMesh"
  111.      Mesh.MeshId = AssetId..Data.MeshId
  112.      Mesh.TextureId = AssetId..Data.TextureId
  113.      Mesh.Scale = Data.Scale
  114.      Mesh.Parent = Part
  115.    
  116.      local Weld = Instance.new("Weld")
  117.      Weld.C0 = CFrame.new(0,0,0)
  118.      Weld.C1 = CFrame.new(-Data.AttachmentPos)
  119.      Weld.Part0 = Character.Head
  120.      Weld.Part1 = Part
  121.      Weld.Parent = Character.Head
  122.    
  123.      Part.Parent = Character
  124. end
  125.  
  126.  
  127. function spawned(Character, Player)
  128.     print("line123")
  129.     local Group = GetPlayerGroupData(Player)
  130.    
  131.     if Group then
  132.             print("line127")
  133.         local Rank = Player:GetRankInGroup(Group.ID)
  134.        
  135.         repeat wait() until Character:FindFirstChild("Head") and Character.Head:FindFirstChild("face")
  136.        
  137.         local GiveHat = false
  138.        
  139.         for _,v in pairs(Group.Hats) do
  140.             if Rank == v.RequiredRank then
  141.                 CreateHat(v,Character)
  142.                 break
  143.             end
  144.         end
  145.     end
  146. end
  147.  
  148. function entered(Player)
  149.     print("line144")
  150.     Player.CharacterAdded:connect(function(Character)
  151.         spawned(Character,Player)
  152.     end)
  153. end
  154.  
  155.  
  156. for _,Player in next, game.Players:GetPlayers() do
  157.     spawned(Player.Character, Player)
  158.    
  159.     entered(Player)
  160. end
  161.  
  162. game.Players.PlayerAdded:connect(function(Player)
  163.     entered(Player)
  164. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement