Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local BillboardGui = script:WaitForChild("RankGui")
- local GroupService = game:GetService("GroupService")
- function getrank(rankintvalue)
- if rankintvalue == nil or rankintvalue == 0 then
- return "Guest"
- end
- if rankintvalue == 1 then
- return "Force Sensitive"
- end
- if rankintvalue == 3 then
- return "Jedi Youngling"
- end
- if rankintvalue == 4 then
- return "Initiate"
- end
- if rankintvalue == 5 then
- return "Padawan"
- end
- if rankintvalue == 7 then
- return "Jedi Knight"
- end
- if rankintvalue == 9 then
- return "Jedi Guardian"
- end
- if rankintvalue == 11 then
- return "Jedi Consular"
- end
- if rankintvalue == 13 then
- return "Jedi Sentinel"
- end
- if rankintvalue == 14 then
- return "Jedi Battle Master"
- end
- if rankintvalue == 15 then
- return "Jedi Instructor"
- end
- if rankintvalue == 17 then
- return "Jedi Master"
- end
- if rankintvalue == 19 then
- return "Engineers"
- end
- if rankintvalue == 21 then
- return "Jedi Elder"
- end
- if rankintvalue == 23 then
- return "Jedi Council"
- end
- if rankintvalue == 255 then
- return "Grandmaster"
- end
- end
- local function groups(player)
- local del = player:FindFirstChild("leaderstats")
- if del then
- del:Destroy()
- end
- local success, erroestatment
- success= false
- while success == false do
- success, erroestatment = pcall(function()
- groupse = GroupService:GetGroupsAsync(player.UserId)
- end)
- print(success)
- -- game.ReplicatedStorage.RemoteEvent:FireAllClients(success,erroestatment)
- end
- local role ,rank = nil
- local count = 1
- while count < #groupse+1 do
- print(count)
- print(groupse[count])
- for key, value in pairs(groupse[count]) do
- if value == "{ The Jedi Order}" then
- role = value
- for key, value in pairs(groupse[count]) do
- if key == "Rank" then
- rank = value
- end
- end
- end
- end
- count = count+1
- end
- print (role)
- print(rank)
- local leaderstats = Instance.new("Model", player)
- leaderstats.Name = "leaderstats"
- leaderstats.Parent = player
- local grouprank = Instance.new("StringValue", leaderstats)
- grouprank.Name = "Rank"
- grouprank.Value = getrank(rank)
- ----------------------------
- local grouprace = Instance.new("StringValue", leaderstats)
- grouprace.Name = "Race"
- grouprace.Value = "Unknown"
- print("done")
- if rank == nil then
- game.Players[tostring(player)].Team = game.Teams.Visitor
- end
- end
- -------------------------------------------------------------------------
- local function OnPlayerAdded(Player)
- Player.CharacterAdded:Connect(function(Character)
- groups(Player)
- Player:WaitForChild("leaderstats")
- local rank = Player["leaderstats"]:WaitForChild("Rank")
- repeat wait() until Character:FindFirstChild("Humanoid") or Player.Character == nil
- if Character:FindFirstChild("Humanoid") then
- local clonedgui = BillboardGui:Clone()
- clonedgui.TextLabel.Text = rank.value
- clonedgui.TextLabel.TextStrokeColor3 = BrickColor.new("Deep orange").Color
- clonedgui.Parent = Character:WaitForChild("Head", 4)
- script.Parent.Parent:Fire(rank.value,Character["Head"])
- end
- end)
- end
- for i,v in pairs(Players:GetPlayers()) do OnPlayerAdded(v) end
- game.Players.PlayerAdded:Connect(OnPlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement