So I am trying to make an object that can be clicked, and when clicked it will prompt the player to buy a gamepass. I have the script inside a ClickDetecter which is inside the object. Here is what I tried but it didn't work.
local player = game.Players.LocalPlayer local id = 573965111 script.Parent.Clicker.ClickDetector.MouseClick:connect(function() game:GetService("MarketplaceService"):PromptPurchase(player, id) end)
If anyone could tell me what I am doing wrong or how to fix it I would be very grateful.
Thanks in advanced!
**In Server Script: **
Note: Make sure 'Clicker' is the part so we can click this part. Make sure to insert a ClickDetector in the part 'Clicker'.
local id = 573965111 script.Parent.Clicker.ClickDetector.MouseClick:connect(function(player) game:GetService("MarketplaceService"):PromptPurchase(player, id) end)
I tried put a SurfaceGui in the StarterGui then inserted this script into the SurfaceGui:
local player = game.Players.LocalPlayer local id = 573965111 script.Parent.Clicker.SurfaceGui.MouseClick:connect(function() game:GetService("MarketplaceService"):PromptPurchase(player, id) end)
and I set the Adornee to the object.
It didn't work so I tried inserting a Clicker to the object and that didn't work, so... What am I doing wrong?