Answered by
8 years ago Edited 8 years ago
Try this, place the script inside the StarterGui.
01 | local p = game.Players.LocalPlayer |
04 | local SG = Instance.new( "SurfaceGui" ) |
05 | SG.Parent = p:WaitForChild( "PlayerGui" ) |
06 | SG.Adornee = game.Workspace.don 8 |
07 | local TB = Instance.new( "TextButton" ) |
09 | TB.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
12 | TB.MouseButton 1 Down:connect( function () |
13 | game:GetService( "MarketplaceService" ):PromptProductPurchase(p, pi) |
Explaination:
PlayerAdded does not fire for the player entering, because the player is created before the scripts. (Might be wrong on this one, but I surely know that PlayerAdded does not fire for the player entering atleast)
The solution is simple, first create a variable named "p" and point it to the localplayer, then parent SG
to the PlayerGui
and set it's adornee to game.Workspace.don8
. Oh and one last thing, don't use Game
, it's deprecated, instead use game
, hope it helps.