Hello! Thank you if you decide to help as I am not good at scripting and I dont know how to solve this problem.
So I have this script in my game that when a player joins and they own the VIP gamepass, they receive a chat tag: [VIP].
The problem is I also have a chat tag for the owner (me), so when I join the game, because I created the gamepass, it shows [VIP] for me and now [Owner] as I own the gamepass.
Can I chance the VIP script so it excludes me and it gives everyone but me that chat tag?
-The script for the VIP gamepass:
local MarketplaceService = game:GetService(“MarketplaceService”)
local GamepassID = 66893336 – 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)
-The script for the owner chat tag:
local ServerScriptService = game:GetService(“ServerScriptService”)
local ChatService = require(ServerScriptService:WaitForChild(“ChatServiceRunner”):WaitForChild(“ChatService”))
local Players = game:GetService(“Players”)
local Owner = {‘ptkalx’} --Change Username to your username
ChatService.SpeakerAdded:Connect(function(PlrName)
local Speaker = ChatService:GetSpeaker(PlrName)
for _, v in pairs(Owner) do
if Players[PlrName].Name == v then
Speaker:SetExtraData(‘Tags’, {{TagText = “Owner”, TagColor = Color3.fromRGB(0, 145, 255)}})
Speaker:SetExtraData(‘NameColor’, Color3.fromRGB(255, 238, 0))
Speaker:SetExtraData(‘ChatColor’, Color3.fromRGB(0, 145, 255))
end
end
end)
local MarketplaceService = game:GetService(“MarketplaceService”)
local GamepassID = 66893336 -- Change ‘000000’ to your Gamepass ID
game.Players.PlayerAdded:Connect(function(Player) --When player join in game
if Player.UserId == YourUserId then return end
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)
May not be the best at explaining this, but I’ll try!
if Player.UserId ~= game.CreatorId then
This is basically checking if the current Player instance, when their character just got added, for their UserId, and comparing it with the Creator’s UserId (A.K.A, you!)
~= means ‘not equal to’, so if the script detects that the Player instance’s UserId is the same as the Creator’s, it will skip the Script for the Creator.
yes user id, i suggest using userid instead of usernames cuz if you’re using your username instead, you might change it in the future, however your userid would never change.
local MarketplaceService = game:GetService(“MarketplaceService”)
local GamepassID = 66893336 – Change ‘000000’ to your Gamepass ID
game.Players.PlayerAdded:Connect(function(Player) --When player join in game
if Player.UserId ~= game.CreatorId then
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
end)
(Was not able to place spaces due to not being in Studio right now, sorry!)
this should work.
replace YourUserId to your roblox userid
local MarketplaceService = game:GetService(“MarketplaceService”)
local GamepassID = 66893336 -- Change ‘000000’ to your Gamepass ID
game.Players.PlayerAdded:Connect(function(Player) --When player join in game
if Player.UserId == YourUserId then return end
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)