Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make a special chat tag if someone owns a certain gamepass?

Asked by 6 years ago
Edited 6 years ago

For example, if someone says something in the chat, their name will show up as "[VIP]" and then their name. I've seen a lot of games that have this feature. I just can't figure out how you add the tag to the player's name. If one of you know how to script quite well, it would be kind to help me with this.

Here's what I've tried:

game.Players.PlayerAdded:Connect(function(player)
    local tags = Instance.new("Folder", player)
    tags.Name = "Tags"
    if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
        local newTag = Instance.new("IntValue", tags)
        newTag.Name = "VIP"
        local chatColor = Instance.new("Color3Value", newTag)
        chatColor.Name = "ChatColor"
        chatColor.Value = BrickColor.new("Gold").Color
        local tagColor = Instance.new("Color3Value", newTag)
        tagColor.Name = "TagColor"
        tagColor.Value = Color3.fromRGB(239, 184, 56)
    end
end)

3 answers

Log in to vote
1
Answered by
yHasteeD 1819 Moderation Voter
6 years ago
Edited 6 years ago

Its simple, roblox already have a module script for this.

Example:


-- Server script local gamepassId = 0 -- Your gamepass id local service = game:GetService("MarketplaceService") game.Players.PlayerAdded:Connect(function(player) if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then -- check if have gamepass local tags = { -- table for tags { -- first tag TagText = "VIP", -- Tag text TagColor = Color3.fromRGB(239, 184, 56) -- TagColor } } local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService) -- Get chat service -- Get speaker local speaker = nil while speaker == nil do speaker = ChatService:GetSpeaker(player.Name) if speaker ~= nil then break end wait(0.01) end speaker:SetExtraData("Tags",tags) -- Set tags speaker:SetExtraData("ChatColor",Color3.fromRGB(239, 184, 56)) -- Change chat color, and dont use BrickColor.new(...).Color end end)

Wiki page for Char modules: Roblox Wiki - Chat

Hope it helped :D


Solved your problems? put in title [SOLVED] or accept a answer.
0
+1, btw you're the first person on this site that I see using ChatService by requiring it from ServerScriptService (that's what i do aswell), rather than by parenting a module to ChatModules under Chat. Amiaa16 3227 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

?Index the PlayersMessage, then tie it to the message using

newTag..": "..ChatMessage
0
Not sure if that User#25448 0 — 6y
0
is what your asking for but there, if it's not please re explain it to me, i didn't quite understand where you were getting at User#25448 0 — 6y
Log in to vote
0
Answered by 6 years ago

First of all, you said just Service without having a variable for it.

Second of all, you didnt assign the tag to the chat system

i dont really know how to assign it to the chat system, but you can probably find it on youtube

Answer this question