So, I want to make this cool system where whenever someone buys a game pass in-server then a message get's displayed with their name and the pass they bought. I have a script for that, but I think it would only work with one person and change every time someone buys it.

I also need help with a function to use that indicates someone bought one and it shows up!

Here is the code in the local script I have.

local passId = 554018090
local marketplaceService = game:GetService("MarketplaceService")
 
marketplaceService.PromptPurchaseFinished:connect(function(player,assetId,isPurchased)
	if isPurchased then
		if assetId == passId then
			script.Parent.Parent:TweenPosition(UDim2.new(0.5, -200, 0, 5), "In", "Quad", 0.5)
			script.Parent.Text = "has bought the Game Pack (" .. passId .. ")"
			wait(2)
			script.Parent.Parent:TweenPosition(UDim2.new(0.5, -200, -2, 5), "Out", "Quad", 0.5)
		end
	end
end)