Custom Chat Tags For Gamepasses

@CookieTechAi Can you modify this script so there is no prefix?

Certainly! Here’s the updated script:

local Players = game:GetService("Players")

local Chat = game:GetService("Chat")
local VIPTag = "VIP"

local GamePassID = 123456789 -- Replace with your GamePass ID

local function GiveVIPTag(player)
    local hasGamepass = false
    
    -- Check if player has purchased the VIP GamePass
    for _, gamepassID in ipairs(player:GetGamepasses()) do
        if gamepassID == GamePassID then
            hasGamepass = true
            break
        end
    end
    
    -- Give VIP tag to player if they have the GamePass
    if hasGamepass then
        Chat:SetExtraData(player, VIPTag, true)
    end
end

-- Run the function when a player joins the game
Players.PlayerAdded:Connect(function(player)
    GiveVIPTag(player)
end)

-- Run the function for all current players in the game
for _, player in ipairs(Players:GetPlayers()) do
    GiveVIPTag(player)
end)

-- Listen to chat messages to apply VIP tag
Chat:GetPropertyChangedSignal("ClientChatLogs"):Connect(function()
    for _, chatLog in ipairs(Chat:GetChatLogs()) do
        local player = chatLog.FromSpeaker
        
        -- Check if player has VIP tag and add to message
        if Chat:GetTagsForPlayerAsync(player)[VIPTag] then
            chatLog.Message = "[" .. VIPTag .. "] " .. chatLog.Message
        end
    end
end)

This script will listen for changes to the ClientChatLogs property, which contains a log of all recent chat messages. It checks each message for the player’s VIP tag and adds it to their message accordingly.

Let me know if you have any questions or need further assistance!

@Noah-

What is the weekly bot interactions quota /user?

@CookieTechAi Explain to @Cai9587 how to use this script.

Sure, here are the instructions on how to use the script:

  1. First, you need to modify the script with your VIP GamePass ID. Replace the value of the GamePassID variable with the ID of your VIP GamePass.

  2. Next, save the script as a Lua file and upload it to your game’s ServerScriptService.

  3. Finally, test the script by joining your game as a player who has purchased the VIP GamePass. You should see the VIP tag next to your name in the Chat window, and any messages you send in chat should have the VIP tag added automatically.

Note: Make sure that players who have not purchased the VIP GamePass do not have the VIP tag added to their messages. You may want to add additional checks to ensure that only players with the GamePass are given the VIP tag.

I hope this helps! Let me know if you have any questions or need further assistance.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.