Hi everyone,
I’m a builder but I have a basic understanding of Lua. I’m trying to create a chat tag for those who purchase my game pass, so they will have a “Premium” label right next to their username in the chatbox. The problem is, it’s not showing up.
The following script isn’t working, the output isn’t showing any errors and the “Go to Script Error” button is blanked out.
local ServerScriptService = game:GetService("ServerScriptService")
local MarketplaceService = game:GetService("MarketplaceService")
local gamepassId = 10304252
local ChatService = require{ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")}
local Players = game:GetService("Players")
ChatService.SpeakerAdded:Connect(function(plrname)
local Speaker = ChatService:GetSpeaker{plrname}
if MarketplaceService:UserOwnsGamePassAsync(Players[plrname].UserId, gamepassId) then
Speaker:SetExtraData('Tags', {{TagText = "Premium", TagColor = Color3.fromRGB(253,89,84)}})
end
end)
The only thing I’ve tried so far is adding spaces between the commas, but I know that’s not gonna do anything. I’m not sure what to do, since I found this on a YouTube tutorial.
I have gone ahead and got this script that had made. I hope this helps and it says how to use it.
-- This is a vip chat I created.
local MarketplaceService = game:GetService(“MarketplaceService”)
local GamepassID = 000000 – Change ‘000000’ to your Gamepass ID
game.Players.PlayerAdded:Connect(function(Player) --When player join in game
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID) then – If player have gamepass…
local tags = {
{
TagText = “VIP”, – Tag Name, You can change to whatever you like
TagColor = Color3.fromRGB(255, 255, 0) – Tag Color, You can change to color you like
}
}
local ChatService = require(game:GetService(“ServerScriptService”):WaitForChild(“ChatServiceRunner”).ChatService) – Requires ChatService
local speaker = nil – speaker is nil
while speaker == nil do – While speaker is nil do…
speaker = ChatService:GetSpeaker(Player.Name) – Get speaker from player
if speaker ~= nil then
break – If speaker is nil then break
end
wait(0.01) – wait
end
speaker:SetExtraData(“Tags”,tags) – Set tags
speaker:SetExtraData(“ChatColor”,Color3.fromRGB(255, 255, 0)) – Chat Color, You can change to color you like
end
end)
Line two “to your Gamepass ID” there is no – brecks everything!
You always have " but into the text!
You forget the – in every line there is a text!!!
Here is the fix!
local gamepassId = 123456789–Gamepass here!
local service = game:GetService(“MarketplaceService”)
game.Players.PlayerAdded:Connect(function(player)
if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
local tags = {
{
TagText = “Premium”,–Tag here!
TagColor = Color3.fromRGB(255, 0, 4)–Tag color!
}
}
local ChatService = require(game:GetService(“ServerScriptService”):WaitForChild(“ChatServiceRunner”).ChatService)
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)
speaker:SetExtraData(“NameColor”,Color3.fromRGB(255, 0, 4))–Change NameColor to ChatColor NameColor Is the name like mine raulgamer43 and ChatColot Is What i say!
end
end)
local gamepassId = 123456789--Gamepass here!
local service = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
local tags = {
{
TagText = "Premium",--Tag here!
TagColor = Color3.fromRGB(255, 0, 4)--Tag color!
}
}
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
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)
speaker:SetExtraData("NameColor",Color3.fromRGB(255, 0, 4))--Change NameColor to ChatColor NameColor Is the name like mine raulgamer43 and ChatColot Is What i say!
end
end)