Are you talking about my script or his?
Your script buddy. Sorry if I made it confusing.
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.
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 â"â?
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.
Probably worth noting here that you can only call LocalPlayer from a client script, which you canât put inside a button.
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)
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.
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.
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.