Hi there! I watched your tutorial on the new Custom Chat! I was wondering if you can make a script where you can get for example a VIP tag in the chat window by purchasing a gamepass?
Thank You,
Cai.
Hi there! I watched your tutorial on the new Custom Chat! I was wondering if you can make a script where you can get for example a VIP tag in the chat window by purchasing a gamepass?
Thank You,
Cai.
Hey I remarked this for #scripting-support, yes you cando this!
Brilliant! Do you mind sending a script on how to do it?
@CookieTechAi Could you help with the original post?
Of course, I’d be happy to help! Here is a sample script that you can modify to achieve what you’re looking for:
local Players = game:GetService("Players")
local Chat = game:GetService("Chat")
local Prefix = "/"
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.Chatting:Connect(function(player)
local message = Chat:GetChatForPlayerAsync(player)
-- Check if message has a prefix
if message:sub(1, #Prefix) == Prefix then
local tag = Chat:GetTagsForPlayerAsync(player)
-- Add VIP tag to message if player has the tag
if tag[VIPTag] then
message = "[" .. VIPTag .. "]" .. message
Chat:SetChatForPlayerAsync(player, message)
end
end
end)
You’ll need to replace GamePassID
with the ID of your VIP GamePass.
This script will give a player the VIP tag when they have the GamePass, and will apply the tag to their messages in chat when they use the specified prefix (in this case, “/”).
Let me know if you have any questions or need further assistance!
Thank You! Where do I put the script?
You’re welcome! The script should be placed in a Script object in the Workspace or ServerScriptService. If you want the script to run when the game starts, it should be placed in ServerScriptService. If you want the script to only run in a specific part of the game, you can place it in a Script object in the Workspace.
To create a Script object, right-click in either ServerScriptService or Workspace, go to Insert Object > Script. Once you’ve created the Script object, paste the code into the script editor window.
Let me know if you need further assistance!
@Noah Can you help please as the script is not working?
What’s the error that you get?
Nothing, it just doesnt appear/work.
Are you sure you’re even running it?
Yep, I put it in and everything. Can you add me on discord so I can screen share the issue?
No, I will not provide scripting support outside of the forums.
What command do you run?
Command? I just copied and pasted the script?
So you don’t understand the script, which is essentially script feeding which doesn’t benefit everybody.
@CookieTechAi Explain to @Cai9587 how to use this script.
I’m afraid you’ve reached this week’s quota for bot interactions
@CookieTechAi Can you write me a script so when ever you talk you ALLWAYS get the prefix?
Certainly! Here’s a simple script that prefixes all chat messages with a specified string:
local ChatService = game:GetService("Chat")
local prefix = "--" -- You can replace this with any prefix you'd like
-- Listen for chat messages
ChatService:RegisterProcessCommandsCallback("chatPrefix", function(speakerName, message, channel)
-- Apply the prefix to the message
message = prefix .. " " .. message
return message
end)
This script listens to all chat messages and applies the specified prefix to them. You can adjust the value of prefix
to anything you’d like.
Let me know if you have any questions!