Helo ? am a pretty new scripter and ? understand this is a crappy script as well But ? am just experimenting and trying to learn and ? dont want 1 million lines coppying this 18 times in total
01 | local billboardgui = game:GetService( "ServerStorage" ):WaitForChild( "BillboardGui" ) |
02 |
03 | player.CharacterAdded:Connect( function (character) |
04 | if player.leaderstats.Rank.Value = = 1 then |
05 | local clonedgui = billboardgui:Clone() |
06 | clonedgui.TextLabel.Text = "Private" |
07 | clonedgui.TextLabel.TextColor 3 = Color 3. fromRGB( 28 , 16 , 186 ) |
08 | clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head |
09 | else |
10 | if player.leaderstats.Rank.Value = = 2 then |
11 | local clonedgui = billboardgui:Clone() |
12 | clonedgui.TextLabel.Text = "Private First class" |
13 | clonedgui.TextLabel.TextColor 3 = Color 3. fromRGB( 28 , 16 , 186 ) |
14 | clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head |
i am yet working on the script and ? just need a fast way to copy these
Your question is pretty vague, but I think what you are trying to do change the text of the clonedgui for each rank. The way to do this is pretty easy
1 | local function CreateRankGui(rankText) |
2 | if player:IsInGroup( 2870505 ) then |
3 | local clonedgui = billboardgui:Clone() |
4 | clonedgui.TextLabel.Text = rankText |
5 | clonedgui.TextLabel.TextColor 3 = Color 3. fromRGB( 28 , 16 , 186 ) |
6 | clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head |
7 | end |
8 | end |
You would put this function at the start of your script, after you define your variables. Then, in your PlayerAdded event, you would keep the if statements for the rank and just insert the function in place of the identical blocks of code:
1 | player.CharacterAdded:Connect( function (character) |
2 | if player.leaderstats.Rank.Value = = 1 then |
3 | CreateRankGui( "Private" ) |
4 | else if player.leaderstats.Rank.Value = = 2 then |
5 | CreateRankGui( "Private First Class" ) |
6 | end |
7 |
8 | end ) |
And then you would just continue the trend with more "else if" statements and different ranks