How to make effect when purchased a gamepass

Hello, so I was wondering what I could do when someone purchased a gamepass in-game. I thought of the game Strucid and wanted to know how to add the confetti after someone bought the item. https://gyazo.com/7def4561e3af035b7e67f0342c95e99d.

Here is my script that I want to add the confetti to, but not sure how to do it.

-- {  Grapple Hook  } --

local function grappleHookPurchased(player)
	wait()
	local PlayerGui = player:WaitForChild("PlayerGui")
	local shopFrame = PlayerGui:WaitForChild("Main").Frame:FindFirstChild("ShopFrame")
	game.ServerStorage.GrappleHook:Clone().Parent = player:WaitForChild("Backpack")
	game.ServerStorage.GrappleHook:Clone().Parent = player:WaitForChild("StarterGear")
	shopFrame.Item1.ClickDetect:Destroy()
	shopFrame.Item1.Check.Visible = true
	shopFrame.Item1.Owned.Visible = true
	shopFrame.Item1.GamepassIcon.Visible = false
	shopFrame.Item1.TextLabel.Visible = false
end

game.Players.PlayerAdded:Connect(function(player)
	if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GrappleGamepassId) then
		grappleHookPurchased(player)
	end
end)

MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, id, wasPurchased)
	if not wasPurchased then
		return
	end

	if id == GrappleGamepassId then
		grappleHookPurchased(player)
	end
end)

You’d need to do an edited version of this: Making an Explosion | Roblox Creator Documentation

Also use :Emit(particleCount[IntValue]) with this

1 Like