Anyone know how to make a click detector gamepass script?

****Hi! I’m a new member here! I was working on a new project known as “Combat Shooter” but the business isn’t going well so I ended up leaving it behind. I only know how to change the behavior on a part with a script and I was looking up for gamepasses with a click detector in it on the internet but none of it seems to work for me :confused:

here is the Color changing script on a part

next is the click detector script

Thank you
@SingaporeSteadyLah

1 Like

Please provide more information about your problem. What methods have you tried? What EXACTLY is it you want to achieve?

local Click = script.Parent

local GamePassID = 000000 -- Change this to your Gamepass ID.

Click.MouseClick:connect(function(player)

game:GetService("MarketplaceService"):PromptPurchase(player,GamePassID)

end)

image
Script should be a child of the click detector.

2 Likes

You will need to put a click detector inside the model/part that you want the player to click & then make a script inside the Model or ServerScriptService, but to keep it clean, you can make it in the model.

Then you could script it up something like this:

local Detector = script.Parent:FindFirstChildOfClass("ClickDetector")
local gamepassID = 21414124 --Your Gamepass ID
local MarketplaceService = game:GetService("MarketplaceService")

Detector.MouseClick:connect(function(player) --MouseClick event automatically passes the player who clicked it.
      MarketplaceService:PromptGamePassPurchase(player, gamepassID ) -- You then prompt the gamepass purchase prompt to that person who clicked it.
end)

API References:

You are not to ask for scripts in devforum.

I suggest you look up click detectors for this

1 Like