this is what i have, and can you maybe make it so it will give an item to the player when bought
function onClicked(p) local CD = script.Parent local ITEM_ID = 689063033 local Click = Instance.new("ClickDetector",CD) game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
local CD = script.Parent local ITEM_ID = 689063033 local Click = Instance.new("ClickDetector",CD) function onClicked(p) game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
It seems you have made an instance for the ClickDetector, but have not set a parent, by making an Instance your second parameter will be where you want to parent it.
function onClicked(playerWhoClicked) local CD = script.Parent local ITEM_ID = 689063033 local Click = Instance.new("ClickDetector",CD) -- not sure why you need this, but I'll leave it in anyway game:GetService("MarketplaceService"):PromptPurchase(playerWhoClicked, ITEM_ID) end end local ClickDetector = Instance.new('ClickDetector', script.Parent) ClickDetector.MouseClick:Connect(onClicked)