Hi devs, i maid this script but it doesn’t work . So if someone can help me to fix it
local MarketplaceService = game:GetService("MarketplaceService")
local TextChatService = game:GetService("TextChatService")
local GamepassIds = {
156269773,
157482066,
156270626,
159552653,
156275308,
159679613,
156277403,
156287007,
156299267,
}
local function onProductPurchaseFinished(player, productId)
for _, gamepassId in pairs(GamepassIds) do
if productId == gamepassId then
local playerName = player.Name
local function generateSystemMsg(MsgDict)
return '<font color="#'..MsgDict["Color"]..'"><font size="'..MsgDict["FontSize"]..'"><font face="'..MsgDict["Font"]..'">'..MsgDict["Text"]..'</font></font></font>'
end
local chatChannel = TextChatService:GetChannel("RBXSystem")
local randomColor = Color3.new(math.random(), math.random(), math.random())
chatChannel:SendSystemMessage(
generateSystemMsg({
Text = playerName.." has just bought a Gamepass!",
Font = "Gotham",
Color = randomColor:ToHex(),
FontSize = "17",
})
)
break
end
end
end
MarketplaceService.PromptProductPurchaseFinished:Connect(onProductPurchaseFinished)