Error in my script

Hello I need help finding how to fix it. There is an error. Can you help me fix it? Thank you.


local serverscriptservice = game:getservice("serverscriptservice")
local players = game:getservice("players")
local owner = {'** username**'}

script.enabled = true
if owner.players
then script.disabled = true
end
else — here’s where I found the error —
	script.enabled = false
end
new local gamepassid = **Game pass ID**
gamepass id local service = game:getservice("marketplaceservice")
game.players.playeradded:connect(function(player))
if (service:userownsgamepassasync(player.userid, gamepassid))
then local tags = { tagtext = "🌹vip🔥",
 tagcolor = color3.fromrgb(255, 255, 0) }

	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("chatcolor",color3.fromrgb(255, 255, 0))

What does the error say? I need more information.

This is the error
image

remove the end there, and it should fix the issue.

Almost everything got underline

Processing: image.jpg…
image

Okay, you should try formatting your script properly. This seems like a format error.

if owner.players then
script.disabled = true
else
script.enabled = false
end

Note: I think you may have done the “script.(something) = boolean” wrong

I appreciate you helping, but it still did the same thing.

What’s the current updated script?

local serverscriptservice = game:getservice("serverscriptservice")
local players = game:getservice("players")
local owner = {"DylanandMarley"}

script.enabled = true
if owner.players
then script.disabled = true
end 
else
	script.enabled = false
end
new local gamepassid = ######
gamepass id local service = game:getservice("marketplaceservice")
game.players.playeradded:connect(function(player))
if (service:userownsgamepassasync(player.userid, gamepassid))
then local tags = { tagtext = "🌹vip🔥",
	tagcolor = color3.fromrgb(255, 255, 0) }

	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("chatcolor",color3.fromrgb(255, 255, 0))

I’m guessing you are a beginner from the amount of errors I immidietly see. I’m working on a fix to your script currently.

1 Like
local players = game:GetService("Players") --Juss the players tab in game.Players
local OwnerID = 2213449830 --Which is this case is dyleddie that I saw from your post
local GamepassId = "example gamepassid" --The gamepass ID
local MarketplaceService = game:GetService("MarketplaceService") --MarketplaceService
local chatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")) --ChatService

local VIPChatTag = {TagText = "🌹vip🔥", TagColor = Color3.fromRGB(255, 255, 0)}

--Custom Tags for specific players
local tags = {
	[OwnerID] = {TagText = "Owner", TagColor = Color3.fromRGB(255, 0, 0)},
	[175704610] = {TagText = "Developer", TagColor = Color3.fromRGB(85, 255, 255)} --Me testing if it works for me.
}

chatService.SpeakerAdded:Connect(function(playerName)
	local speaker = chatService:GetSpeaker(playerName)
	local player = game.Players[playerName]
	
	if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then
		speaker:SetExtraData({TagText = "🌹vip🔥", TagColor = Color3.fromRGB(255, 255, 0)})
	end
	
	if tags[player.UserId] then
		speaker:SetExtraData("Tags",{tags[player.UserId]})
	end
end)

This all should work. Just make sure to edit the variables at the top and remove me from player specific chat tags if you want.

1 Like

I’m so sorry to bug you about it. But The VIP game pass chat tag doesn’t work. :frowning:
I own the game pass and it doesn’t work the chat chat sadly.
Here’s a screenshot.

Before you say, I don’t know how to update the game I do.
And I know how to update, scripts. It just looks like it doesn’t work. I also filled in everything like the user IDs and stuff.

local players = game:GetService("Players") --Just the players tab in game.Players
local OwnerID = 2213449830 --Which is this case is dyleddie that I saw from your post
local GamepassId = 31021147 --The gamepass ID
local MarketplaceService = game:GetService("MarketplaceService") --MarketplaceService
local chatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")) --ChatService

--Tag you get if you own the gamepassId
local VIPChatTag = {TagText = "🌹vip🔥", TagColor = Color3.fromRGB(255, 255, 0)}

--Custom Tags for specific players
local tags = {
	[OwnerID] = {TagText = "Owner", TagColor = Color3.fromRGB(255, 0, 0)},
	[175704610] = {TagText = "Developer", TagColor = Color3.fromRGB(85, 255, 255)},
}


--Script that adds the tag to ther user.
chatService.SpeakerAdded:Connect(function(playerName)
	local speaker = chatService:GetSpeaker(playerName)
	local player = game.Players[playerName]

	if tags[player.UserId] then
		print("Player has a custom chat tag!")
		speaker:SetExtraData("Tags",{tags[player.UserId]})
	elseif MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then
		print("Player owns the gamepass!")
		speaker:SetExtraData("Tags", {VIPChatTag})
	else
		print("Request Denied.")
	end
end)

Updated script that has been fully tested. I’ll fix it tomorrow if it doesn’t work for you. Of course change the variables again at the top and so on. Best regards Liquify

1 Like

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