Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.22 KB | None | 0 0
  1. --I just spam copypasta'd all over the place with the hat configuration, you can delete it if you want, as I am not sure how many hats you want.
  2. --there is also no need to put your hats anywhere, this will create the hats for you if you put the meshid, texture, and scale
  3. local AssetId = "http://www.roblox.com/asset/?id="
  4. local ss = game:service("ServerStorage")
  5.  
  6. local Branches = {
  7.         ["Legion"] = {
  8.                 ["ID"] = 2527165,
  9.                 ["Hats"] = {
  10.                         ------------------------------------------
  11.                         {
  12.                                 ["Name"] = "Recruit",
  13.                                 ["RequiredRank"] = 10,
  14.                                 ["MeshId"] = 16127787,
  15.                                 ["TextureId"] = 222567180,
  16.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  17.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  18.                         },
  19.                     --
  20. {
  21.                                 ["Name"] = "Prime",
  22.                                 ["RequiredRank"] = 15,
  23.                                 ["MeshId"] = 16127787,
  24.                                 ["TextureId"] = 222567180,
  25.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  26.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  27.                         },
  28.                     --
  29. {
  30.                                 ["Name"] = "Veteran",
  31.                                 ["RequiredRank"] = 20,
  32.                                 ["MeshId"] = 16127787,
  33.                                 ["TextureId"] = 222567212,
  34.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  35.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  36.                         },
  37.                     --
  38. {
  39.                                 ["Name"] = "Vexillarius",
  40.                                 ["RequiredRank"] = 25,
  41.                                 ["MeshId"] = 55700799,
  42.                                 ["TextureId"] = 55700903,
  43.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  44.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  45.                         },
  46.                     --
  47. {
  48.                                 ["Name"] = "RecDec",
  49.                                 ["RequiredRank"] = 100,
  50.                                 ["MeshId"] = 16127787,
  51.                                 ["TextureId"] = 222567180,
  52.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  53.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  54.                         },
  55.                     --
  56. {
  57.                                 ["Name"] = "PrimeDec",
  58.                                 ["RequiredRank"] = 105,
  59.                                 ["MeshId"] = 16127787,
  60.                                 ["TextureId"] = 222567180,
  61.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  62.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  63.                         },
  64.                     --
  65. {
  66.                                 ["Name"] = "VetDec",
  67.                                 ["RequiredRank"] = 110,
  68.                                 ["MeshId"] = 16127787,
  69.                                 ["TextureId"] = 222567212,
  70.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  71.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  72.                         },
  73.                     --
  74. {
  75.                                 ["Name"] = "Centurion",
  76.                                 ["RequiredRank"] = 150,
  77.                                 ["MeshId"] = 64510477,
  78.                                 ["TextureId"] = 64510503,
  79.                                 ["Scale"] = Vector3.new(1, 1, 1.05),
  80.                                 ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
  81.                         },
  82.                     --
  83.  
  84.                         -------------------------------------------
  85.                 }
  86.         },
  87. }
  88.  
  89. function GetPlayerGroupData(Player)
  90.         for _,v in pairs(Branches) do
  91.                
  92.                 if Player.TeamColor == game.Teams["Caesar's ".._].TeamColor then
  93.                         return v
  94.                 end
  95.         end
  96.         return nil
  97. end
  98.  
  99. function CreateHat(Data, Character)
  100.         local Part = Instance.new("Part")
  101.         Part.Name = Data.Name
  102.         Part.Size = Vector3.new(1,1,1)
  103.        
  104.         local Mesh = Instance.new("SpecialMesh")
  105.         Mesh.MeshType = "FileMesh"
  106.         Mesh.MeshId = AssetId..Data.MeshId
  107.         Mesh.TextureId = AssetId..Data.TextureId
  108.         Mesh.Scale = Data.Scale
  109.         Mesh.Parent = Part
  110.        
  111.         local Weld = Instance.new("Weld")
  112.         Weld.C0 = CFrame.new(0,0,0)
  113.         Weld.C1 = CFrame.new(-Data.AttachmentPos)
  114.         Weld.Part0 = Character.Head
  115.         Weld.Part1 = Part
  116.         Weld.Parent = Character.Head
  117.        
  118.         Part.Parent = Character
  119. end
  120.  
  121. function entered(Player)
  122.     Player.CharacterAdded:connect(function(Character)
  123.         --local Group = Branches.Army -- PlaySolo friendly debugging variable, however only one of these group variables can be activenat one time..
  124.         local Group = GetPlayerGroupData(Player)
  125.         if Group then
  126.             local Rank = Player:GetRankInGroup(Group.ID)
  127.            
  128.             repeat wait() until Character:FindFirstChild("Head") and Character.Head:FindFirstChild("face")
  129.            
  130.             local GiveHat = false
  131.            
  132.             for _,v in pairs(Group.Hats) do
  133.                 if Rank <= v.RequiredRank then
  134.                     CreateHat(v,Character)
  135.                     break
  136.                 end
  137.             end
  138.         end
  139.     end)
  140. end
  141.  
  142.  
  143. for _,Player in next, game.Players:GetPlayers() do
  144.     entered(Player)
  145. end
  146.  
  147. game.Players.PlayerAdded:connect(function(Player)
  148.     entered(Player)
  149. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement