Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gamepass for chat color?

So im making a showcase thing so when you buy a gamepass you get a chat color but it is telling me that

GamePassId '14802731' is not of type Game Pass. Please use MarketplaceService:PlayerOwnsAsset instead.

When its a gamepass (Its not working with PlayerOwnsAsset)

Here is the script thanks in advanced.

local MarketPlaceService = game:GetService("MarketplaceService")
local Player = game:GetService("Players").LocalPlayer

local PremId = 14802731
local EliteId = 14802760

local settingsNorm = {	
	BubbleDuration = 15,
	MaxBubbles = 3,
	
	BackgroundColor3 = Color3.fromRGB(186, 250, 112),
	TextColor3 = Color3.fromRGB(57, 59, 61),
	TextSize = 16,
	Font = Enum.Font.GothamSemibold,
	Transparency = .1,
	CornerRadius = UDim.new(0, 12),
	TailVisible = true,
	Padding = 8,
	MaxWidth = 300,

	VerticalStudsOffset = 0,

	BubblesSpacing = 6,

	MinimizeDistance = 40,
	MaxDistance = 100,
}

local settingsPrem = {	
	BubbleDuration = 15,
	MaxBubbles = 3,

	BackgroundColor3 = Color3.fromRGB(250, 178, 247),
	TextColor3 = Color3.fromRGB(57, 59, 61),
	TextSize = 16,
	Font = Enum.Font.GothamSemibold,
	Transparency = .1,
	CornerRadius = UDim.new(0, 12),
	TailVisible = true,
	Padding = 8,
	MaxWidth = 300,

	VerticalStudsOffset = 0,

	BubblesSpacing = 6,

	MinimizeDistance = 40,
	MaxDistance = 100,
}

local settingsElite = {	
	BubbleDuration = 15,
	MaxBubbles = 3,

	BackgroundColor3 = Color3.fromRGB(170, 0, 0),
	TextColor3 = Color3.fromRGB(57, 59, 61),
	TextSize = 16,
	Font = Enum.Font.GothamSemibold,
	Transparency = .1,
	CornerRadius = UDim.new(0, 12),
	TailVisible = true,
	Padding = 8,
	MaxWidth = 300,

	VerticalStudsOffset = 0,

	BubblesSpacing = 6,

	MinimizeDistance = 40,
	MaxDistance = 100,
}

pcall(function()
	if game:GetService("GamePassService"):PlayerHasPass(Player, PremId) then
		game:GetService("Chat"):SetBubbleChatSettings(settingsPrem)	
	elseif game:GetService("GamePassService"):PlayerHasPass(Player, EliteId) then
		game:GetService("Chat"):SetBubbleChatSettings(settingsElite)	
	else
		game:GetService("Chat"):SetBubbleChatSettings(settingsNorm)
	end
end)

2 comments

0

The Error is that it wants you to use the MarketPlace Service go here to see what it means https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/UserOwnsGamePassAsync

0

on the PCALL Function its checking if the player has the pass

1 answer

Example Script;

local MarketPlaceService = game:GetService("MarketPlaceService")

local PlayerBoughtThisGamePass =  MarketPlaceService.UserOwnsGamePassAsync(Userid, GamePassIDHere)

if PlayerBoughtThisGamePass then
  print("Player Has Bought This GamePass")
end

This discussion is preserved as it was. New answers, comments, and votes are closed.