I’ve got an script which is supposed to popup purchase prompt when brick touched and grant the item after purchase is done (RemoteEvent).
For some reason, the purchase prompt is not popping up.
Any clue what’s wrong with my script?
This is a Script, not a LocalScript, located inside the brick:
wait(2)
function onTouch(hit)
local mps = game:GetService("MarketplaceService")
local gamepass_id = 7041868
script.Parent.Touched:connect(function()
local player = game.Players.LocalPlayer
mps:PromptGamePassPurchase(player, gamepass_id)
end)
mps.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
if id == gamepass_id and purchased then
game.ReplicatedStorage.Give3:FireServer()
end
end)
end
script.Parent.Touched:connect(onTouch)