Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will my script for a part being clicked granting you the option to buy a gamepass not work?

Asked by
iVmk3 -143
4 years ago

My current script:

local CLICK_BLOCK = script.Parent
local ITEM_ID = 8827494 -- My gamepass

local Click = Instance.new("ClickDetector", CLICK_BLOCK)

Click.MouseClick:Connect(function(player)
    game:GetService("MarketplaceService"):PromptGamepassPurchace(player,ITEM_ID)
end)

0
You spelled PromptGamePassPurchase wrong. Should be PromptGamePassPurchase. AntiWorldliness 868 — 4y
0
yup Hydrogyn 155 — 4y
0
Oh ok! I will try this now! iVmk3 -143 — 4y
0
Well, It does not work. Like most of my things. iVmk3 -143 — 4y
0
My bad. I forgot to say that this should be in a LocalScript, which should be in your Part. Then change "player" on line 7 to "game.Players.LocalPlayer". You don't need a click detector either. Instead, use MouseButton1Click. I will show you the complete script down below. AntiWorldliness 868 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Local Script

local CLICK_BLOCK = script.Parent.ClickDetector
local ITEM_ID = 8827494 -- My gamepass

CLICK_BLOCK.MouseClick:Connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,ITEM_ID)
end)

Hope this helps!

0
Do I still keep a Click Detector in the part? iVmk3 -143 — 4y
0
Ok. iVmk3 -143 — 4y
0
I was wondering because it did not work either. iVmk3 -143 — 4y
0
Im flipping done with this. Have some points. iVmk3 -143 — 4y
0
Oh, I'm sorry that I was not able to help. Thank you for accepting anyways, and good luck with your game! AntiWorldliness 868 — 4y
Ad

Answer this question