Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Module
- -- by senko
- local m = {}
- m.__index = m
- function m.Init(plr, array)
- local newRank = {}
- setmetatable(newRank, m)
- local rankName = array['Rank']
- local Color = array['Color']
- local Clone = script:WaitForChild("BillboardGui"):Clone()
- Clone.Name = plr.Name.."'s Rank Tag"
- Clone.Parent = plr.Character.Head
- Clone.TextLabel.Text = tostring(rankName)
- Clone.TextLabel.TextColor3 = Color
- --// setting vals
- newRank.Player = plr.UserId
- newRank.RankTag = Clone
- return newRank
- end
- function m:Update(plr, array)
- local Rank = array["Rank"]
- local Color = array["Color"]
- if Rank and Color then
- if Rank == "No Change" then
- self.RankTag.TextLabel.TextColor3 = Color
- else
- self.RankTag.TextLabel.Text = tostring(Rank)
- self.RankTag.TextLabel.TextColor3 = Color
- end
- warn("Successfully updated rank tag for ".. plr.Name.. " || INFO: RankName = ".. tostring(Rank).. ' | RankColor = '.. tostring(Color))
- end
- end
- function m:Delete()
- self.RankTag:Destroy()
- end
- return m
- _____________________________________________________
- -- Main Script
- local s = game:GetService("ReplicatedStorage")
- local m = require(s:WaitForChild("OverheadRank"))
- local p = game:GetService("Players")
- local playerTags = {};
- p.PlayerAdded:Connect(function(plr)
- plr.Chatted:Connect(function(msg)
- msg = msg:lower()
- -- !changeColor
- if msg == "!changecolor" then
- local randomColor = Color3.fromRGB(math.random(1,255), math.random(1,255), math.random(1,255))
- local rankTag = playerTags[plr.UserId]
- if not rankTag then
- warn("Your rank tag hasn't been created yet.")
- return;
- end
- rankTag:Update(plr, {Rank = "No Change", Color = randomColor})
- end
- if msg == "!destroy" then
- local rankTag = playerTags[plr.UserId]
- if not rankTag then
- warn("Your rank tag hasn't been created yet.")
- return;
- end
- rankTag:Delete()
- rankTag = nil
- end
- end)
- plr.CharacterAdded:Connect(function(char)
- local rankTag = m.Init(plr, {Rank = "Owner", Color = Color3.fromRGB(34,139,34)} )
- playerTags[plr.UserId] = rankTag
- wait(5)
- rankTag:Update(plr, {Rank = "Developer", Color = Color3.fromRGB(139,0,0)})
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement