Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --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.
- --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
- local AssetId = "http://www.roblox.com/asset/?id="
- local ss = game:service("ServerStorage")
- local Branches = {
- ["Legion"] = {
- ["ID"] = 2527165,
- ["Hats"] = {
- ------------------------------------------
- {
- ["Name"] = "Recruit",
- ["RequiredRank"] = 10,
- ["MeshId"] = 16127787,
- ["TextureId"] = 222567180,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "Prime",
- ["RequiredRank"] = 15,
- ["MeshId"] = 16127787,
- ["TextureId"] = 222567180,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "Veteran",
- ["RequiredRank"] = 20,
- ["MeshId"] = 16127787,
- ["TextureId"] = 222567212,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "Vexillarius",
- ["RequiredRank"] = 25,
- ["MeshId"] = 55700799,
- ["TextureId"] = 55700903,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "RecDec",
- ["RequiredRank"] = 100,
- ["MeshId"] = 16127787,
- ["TextureId"] = 222567180,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "PrimeDec",
- ["RequiredRank"] = 105,
- ["MeshId"] = 16127787,
- ["TextureId"] = 222567180,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "VetDec",
- ["RequiredRank"] = 110,
- ["MeshId"] = 16127787,
- ["TextureId"] = 222567212,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- {
- ["Name"] = "Centurion",
- ["RequiredRank"] = 150,
- ["MeshId"] = 64510477,
- ["TextureId"] = 64510503,
- ["Scale"] = Vector3.new(1, 1, 1.05),
- ["AttachmentPos"] = Vector3.new(0, 0, 0) -- You will have to mess with this to get it right for every hat.
- },
- --
- -------------------------------------------
- }
- },
- }
- function GetPlayerGroupData(Player)
- for _,v in pairs(Branches) do
- if Player.TeamColor == game.Teams["Caesar's ".._].TeamColor then
- return v
- end
- end
- return nil
- end
- function CreateHat(Data, Character)
- local Part = Instance.new("Part")
- Part.Name = Data.Name
- Part.Size = Vector3.new(1,1,1)
- local Mesh = Instance.new("SpecialMesh")
- Mesh.MeshType = "FileMesh"
- Mesh.MeshId = AssetId..Data.MeshId
- Mesh.TextureId = AssetId..Data.TextureId
- Mesh.Scale = Data.Scale
- Mesh.Parent = Part
- local Weld = Instance.new("Weld")
- Weld.C0 = CFrame.new(0,0,0)
- Weld.C1 = CFrame.new(-Data.AttachmentPos)
- Weld.Part0 = Character.Head
- Weld.Part1 = Part
- Weld.Parent = Character.Head
- Part.Parent = Character
- end
- function entered(Player)
- Player.CharacterAdded:connect(function(Character)
- --local Group = Branches.Army -- PlaySolo friendly debugging variable, however only one of these group variables can be activenat one time..
- local Group = GetPlayerGroupData(Player)
- if Group then
- local Rank = Player:GetRankInGroup(Group.ID)
- repeat wait() until Character:FindFirstChild("Head") and Character.Head:FindFirstChild("face")
- local GiveHat = false
- for _,v in pairs(Group.Hats) do
- if Rank <= v.RequiredRank then
- CreateHat(v,Character)
- break
- end
- end
- end
- end)
- end
- for _,Player in next, game.Players:GetPlayers() do
- entered(Player)
- end
- game.Players.PlayerAdded:connect(function(Player)
- entered(Player)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement