Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TitlesEvent = game.ReplicatedStorage.TitlesEvent
- local DataStore = game:GetService("DataStoreService"):GetDataStore("Rank")
- local Players = game:GetService("Players")
- local ClonedGui = script:WaitForChild("OverHead"):Clone()
- Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function(char)
- local Rank = Instance.new("StringValue", player)
- Rank.Name = "Rank"
- Rank.Value = player.Rank.Value
- ClonedGui.Parent = char.Head
- local PlayerName = player.Name
- ClonedGui.nameLabel.Text = PlayerName
- ClonedGui.titleLabel.Text = Rank.Value
- TitlesEvent.PremiumEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "Premium"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = true
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.NoneEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = ""
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.NoviceEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "NOVICE"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.NoviceEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "ROOKIE"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.VisitorEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "VISITOR"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.CitizenEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "CITIZEN"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.PackagerEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "PACKAGER"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.NeighborEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "NEIGHBOR"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.ChampionEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "CHAMPION"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.LandLordEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "LANDLORD"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.BeastEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "BEAST"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.WinnerEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "WINNER"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 1)
- end)
- TitlesEvent.VIPEvent.OnServerEvent:Connect(function(player)
- player.Rank.Value = "VIP"
- ClonedGui.titleLabel.Text = player.Rank.Value
- ClonedGui.titleLabel.UIGradient.Enabled = false
- ClonedGui.titleLabel.TextColor3 = Color3.new(1, 1, 0)
- end)
- end)
- end)
- game:BindToClose(function() -- Runs whenver the server is about to shut down/stop.
- print("STOPPED!")
- for i,player in pairs(game.Players:GetPlayers()) do
- local value = player.Rank.Value
- DataStore:SetAsync(player.UserId, value)
- print("Saved data for "..player.Name)
- end
- end)
- Players.PlayerRemoving:Connect(function(player)
- local value = player.Rank.Value
- if value ~= nil then
- print("Found data to save for "..player.Name.."!")
- DataStore:SetAsync(player.UserId, value)
- print("Saved data for "..player.Name)
- else
- print("Did not manage to find data to save for "..player.Name.."!")
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement