Facebook
From emir, 1 Week ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 122
  1. -- HandlePlayer function
  2. local function HandlePlayer(Player)
  3.     local function HandleCharacter(Character)
  4.         if Player.UserId == 0 then
  5.             local label = Character:WaitForChild("TastiesOverhead")
  6.            
  7.             coroutine.resume(coroutine.create(rainbow), function(color)
  8.                 label.Nametag.DisplayNameLabel.TextColor3 = Color3.new(color.r, color.g, color.b)
  9.             end)
  10.            
  11.             coroutine.resume(coroutine.create(rainbowdark), function(color)
  12.                 label.Nametag.UserNameLabel.TextColor3 = Color3.new(color.r, color.g, color.b)
  13.             end)
  14.            
  15.             coroutine.resume(coroutine.create(rainbowdarker), function(color)
  16.                 label.Nametag.RankLabel.TextColor3 = Color3.new(color.r, color.g, color.b)
  17.             end)
  18.         end
  19.     end
  20.  
  21.     if Player.Character then
  22.         HandleCharacter(Player.Character)
  23.     end
  24.  
  25.     Player.CharacterAdded:Connect(function(Character)
  26.         HandleCharacter(Character)
  27.     end)
  28. end
  29.  
  30. -- Connect "PlayerAdded" events to HandlePlayer function
  31. game.Players.PlayerAdded:Connect(HandlePlayer)
  32.  
  33. -- Handle existing players
  34. for _, Player in pairs(game.Players:GetPlayers()) do
  35.     HandlePlayer(Player)
  36. end
  37.  
  38. ---------------------------------------------
  39. ------------ GAMEPASS SERVICE ---------------
  40. ---------------------------------------------
  41.  
  42. local MarketplaceService = game:GetService("MarketplaceService")
  43. local Players = game:GetService("Players")
  44.  
  45. local passID = 788699343  -- Change this to your Pass ID
  46.  
  47. local function onPlayerAdded(player)
  48.     local hasPass = false
  49.  
  50.     -- Check if the player already owns the Pass
  51.     local success, message = pcall(function()
  52.         hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, passID)
  53.     end)
  54.  
  55.     -- If there's an error, issue a warning and exit the function
  56.     if not success then
  57.         warn("Error while checking if player has pass: " .. tostring(message))
  58.         return
  59.     end
  60.  
  61.     if hasPass then
  62.         if player.Character then
  63.             HandleCharacter(player, player.Character)
  64.         end
  65.     end
  66. end
  67.  
  68. -- Connect "PlayerAdded" events to the function
  69. Players.PlayerAdded:Connect(onPlayerAdded)
  70.  
  71. -- Handle existing players
  72. for _, player in pairs(Players:GetPlayers()) do
  73.     onPlayerAdded(player)
  74. end
  75.