Marketplace popup issues

Are you talking about my script or his?

Your script buddy. Sorry if I made it confusing.

1 Like

You can just make a ScreenGui in StarterGui and put it in there

Actually, change the script to:

while true do
wait(0.05)
repeat
wait(0.05)
until game.Players.LocalPlayer.Character:WaitForChild(“Humanoid”).Health == 0
wait(1)
local MPS = game:GetService(“MarketplaceService”)
MPS:PromptProductPurchase(game.Players.LocalPlayer, 958300491)
end

I noticed that it doesn’t prompt if you die again.

Add a print statement just before it prompts the player with the product and see what happens, because I cannot see the problem in the script.

1 Like

Your script did not work, I got this in the output. 23:09:01.939 - Players.hireimgeorge.PlayerGui.DeathGui.Frame.Respawn.LocalScript:3: Unexpected Unicode character: U+201c. Did you mean ‘"’?

1 Like

Not sure then. I know a bit of scripting, but I can’t script something crazy like Jailbreak.

For what its worth, your code is inefficient seeming as its reliant on wait statements and repeat statements. Not to mention you are essentially asking him to repeat and wait constantly until the player is finally dead.

Even though you can do this…

local MarketplaceService = game:GetService("MarketplaceService")
local GamepassId = 0

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			MarketplaceService:PromptProductPurchase(player, GamepassId)
		end)
	end)
end)

This then binds onto a pre-given call.

3 Likes

Probably worth noting here that you can only call LocalPlayer from a client script, which you can’t put inside a button.

1 Like

This is for everytime a player dies

local Humanoid = Player.Character:WaitForChild('Humanoid')
local Id = 947365701

local MarketPlaceService = game:GetService('MarketplaceService')

Humanoid.Died:Connect(function()
	if Player and Id then
		MarketPlaceService:PromptProductPurchase(Player, Id)
		end
end)
1 Like

I would honestly try the above, its formatted nicely and shouldn’t have any unicode issues. His method for what it is worth is poor and I can’t in good faith recommend you use it in your code.

Inherently the issue seemed more to do with your button properties at first instead of your code, therefore this whole discussion is probably useless.

1 Like

It has nothing to do with the button. I have been through all the properties of it.

Is it the script that isn’t working?

Yes it is. I have no idea why.

So it doesn’t prompt the product at all? or just only once?

I’ll have a look at one of the dev product purchase scripts in one of my games and I’ll send you that with your ID.

It doesn’t prompt the purchase at all.

If the script doesn’t throw errors then its either something to do on the UI end or the properties. I fail to believe the lua engine isn’t working for specifically you. At this point I am going to just make you the entire thing in my own studio so we don’t have this issue and you can compare for the future.

1 Like

Here’s a simple 3 line script that could possibly work or not.

script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptProductPurchase(game.Players.LocalPlayer, YOURIDHERE)
end)

There’s a typo, when you made the variable button the b wasn’t capitalized, but when you fired the event it was.

2 Likes