I’m trying to make it so if you trigger the prompt it will show up with a developer product. But it’s not doing anything, there isn’t any errors either. The script is in the proximity prompt.
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local productID = 1262549913
if script.Parent.Triggered then
local function promptPurchase()
local player = Players.LocalPlayer
MarketplaceService:PromptProductPurchase(player, productID)
end
end
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local productID = 1262549913
local function promptPurchase()
local player = Players.LocalPlayer
MarketplaceService:PromptProductPurchase(player, productID)
end
if script.Parent.Triggered then
promptPurchase()
end
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local productID = 1262549913
local function promptPurchase(player)
MarketplaceService:PromptProductPurchase(player, productID)
end
script.Parent.Triggered:Connect(function(player)
promptPurchase(player)
end
This is the only way it will work, even if the other script was a local script the function would fire because you don’t detect when the prompt gets triggered you only did it once, this way it will fire Everytime you trigger it
I have done this now but it’s still saying in the output, “MarketplaceService:PromptProductPurchase() player should be of type Player”. I don’t know if it’s because I’m using a starterchacter.
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local productID = 1262549913
local myPrompt = workspace.OneHundredCoins.Coins1.ProximityPrompt
local function promptPurchase(player)
MarketplaceService:PromptProductPurchase(player, productID)
end
game.Workspace.OneHundredCoins.Coins1.ProximityPrompt.Triggered:Connect(promptPurchase)
If you’re using a server script then you cant use the local player in it, I’m pretty sure the function is getting confused on what variable to use so it uses the local player one which you cant use, it will return nil.
Also, what do you mean by using the starter character? is this script parented under starter-character scripts? If so, put it under the prompt.
Try this script:
local MarketplaceService = game:GetService(“MarketplaceService”)
local productID = 1262549913
local myPrompt = workspace.OneHundredCoins.Coins1.ProximityPrompt
I did the something really stupid, I had two proximity prompts because there’s two coins in the model so I was pressing the original one I was supposed to delete ages ago.