Roblox provides all of the event needed to achieve this:-
PlayerAdded
CharacterAdded
PromptPurchaseFinished
This is an example only:-
local mpSrv = game:GetService('MarketplaceService')
local srvSorage = game:GetService('ServerStorage'):WaitForChild('ScreenGui')
local asset = 422504693
game.Players.PlayerAdded:connect(function (plr)
plr.CharacterAdded:connect(function (plrModel)
local player = game.Players:GetPlayerFromCharacter(plrModel)
if player then
if mpSrv:PlayerOwnsAsset(player, asset) then
local gui = plr:WaitForChild('PlayerGui')
srvSorage:Clone().Parent = gui
end
end
end)
end)
mpSrv.PromptPurchaseFinished:connect(function(plr, assetId, isPurchased)
if isPurchased and assetId == asset then
local gui = plr:WaitForChild('PlayerGui')
srvSorage:Clone().Parent = gui
end
end)
As I said this is only an example and it is un-tested. There are more efficient ways of doing this instead of checking each time if the player owns the asset.
Pls comment if you do not understand how this code works.
Hope this helps.