-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOverheadTagAPI
More file actions
121 lines (101 loc) · 3.43 KB
/
OverheadTagAPI
File metadata and controls
121 lines (101 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
local overheadTag = {}
local config = require(script.Parent.Parent.Parent:WaitForChild("SR_Loader").Config)
local rankAPI = require(script.Parent.RankAPI)
local overheadTagConfig = config["Overhead Tag"]
local overheadTagEnabled = overheadTagConfig["Enabled"]
local overheadTagCMD = overheadTagConfig["EnableDisableTagCMD"]
local staffTagObject = script.Parent.Parent.MiscellaneousStuff.StaffTag
function overheadTag.SwapStates(plr:Player,cmd)
if plr and overheadTagEnabled and cmd then
if string.lower(cmd) == string.lower(overheadTagCMD) then
local char = plr.Character or plr.CharacterAdded:Wait()
local cStuff = char:GetChildren()
for i=1,#cStuff do
if cStuff[i]:IsA("BillboardGui") and cStuff[i]:GetAttribute("StaffTag") then
cStuff[i].Enabled = not cStuff[i].Enabled
break
end
end
end
end
end
function overheadTag.SetTag(plr:Player)
if plr and overheadTagEnabled then
local stringrank = nil
local rankColor = nil
local CustomRanks = config["Custom Ranks"]
local Group = config["Group"]
local GroupRanks = Group["Ranks"]
local Trello = config["Trello Stuff"]
local TrelloRanks = Trello["Ranks"]
local TrelloAPI = require(script.Parent.Parent["API's"].TrelloAPI)
if plr.UserId == game.CreatorId then
stringrank = CustomRanks["Owner"]["RankName"]
rankColor = CustomRanks["Owner"]["StaffTag"]["TagColor"]
else
local rankInfo = rankAPI.GetChatTag(plr)
stringrank = rankInfo[4]
rankColor = rankInfo[2]
end
if stringrank ~= nil and rankColor ~= nil then
local char = plr.Character or plr.CharacterAdded:Wait()
local hasTag,userTagObj = false,nil
local cStuff = char:GetChildren()
for i=1,#cStuff do
if cStuff[i]:IsA("BillboardGui") and cStuff[i]:GetAttribute("StaffTag") then
hasTag = true
userTagObj = cStuff[i]
break
end
end
if hasTag == false then
local nStaffTag = staffTagObject:Clone()
nStaffTag.Main.Text.RankText.Text = tostring(stringrank)
nStaffTag.Main.Text.RankText.TextColor3 = rankColor
nStaffTag.Main.OverlayT.BackgroundColor3 = rankColor
nStaffTag.Main.OverlayB.BackgroundColor3 = rankColor
nStaffTag.Parent = char
nStaffTag.Adornee = char.Head
nStaffTag.Enabled = true
else
userTagObj.Main.Text.RankText.Text = tostring(stringrank)
userTagObj.Main.Text.RankText.TextColor3 = rankColor
userTagObj.Main.OverlayT.BackgroundColor3 = rankColor
userTagObj.Main.OverlayB.BackgroundColor3 = rankColor
end
end
end
end
function overheadTag.UpdateTag(plr:Player,strRank,color)
if plr and strRank and color then
local char = plr.Character or plr.CharacterAdded:Wait()
if strRank == "Regular / No Rank" then
local cStuff = char:GetChildren()
for i=1,#cStuff do
if cStuff[i]:IsA("BillboardGui") and cStuff[i]:GetAttribute("StaffTag") then
cStuff[i]:Destroy()
break
end
end
else
local userStaffTag = nil
local cStuff = char:GetChildren()
for i=1,#cStuff do
if cStuff[i]:IsA("BillboardGui") and cStuff[i]:GetAttribute("StaffTag") then
userStaffTag = cStuff[i]
break
end
end
if userStaffTag ~= nil then
local RankText = userStaffTag.Main.Text.RankText
local cTop = userStaffTag.Main.OverlayT
local cBottom = userStaffTag.Main.OverlayB
RankText.Text = tostring(RankText)
RankText.TextColor3 = color
cTop.BackgroundColor3 = color
cBottom.BackgroundColor3 = color
end
end
end
end
return overheadTag