Hey there fellow devs,
I got this script here that is supposed to clone a frame and make the text the players name if they own a gamepass but it is not working and im not sure why Final Goal: To clone a frame if a player owns a gamepass and change the text.
game.Players.PlayerAdded:Connect(function(plr)
local id = 19037029
local template = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame.Template
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,id,purchased)
if purchased and id == id then
local clonetemplate = template:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
end)
local id = 19037029
local template = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame.Template
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,id,purchased)
if purchased and id == id then
local clonetemplate = template:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
local passid = 19037029
local template = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame.Template
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,id,purchased)
if purchased == true and id == passid then
local clonetemplate = template:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
local MarketplaceService = game:GetService("MarketplaceService")
local gamepass_id = 19037029
local template = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame.Template
game.Players.PlayerAdded:Connect(function(player)
wait(5)
MarketplaceService:PromptGamePassPurchase(player, gamepass_id)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(plr,id,purchased)
if purchased and gamepass_id == id then
local clonetemplate = template:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
This will prompt the user the gamepass on join (you can remove this after testing)
Accept it (it wont charge you anything in studio) and see if the prints fire
local MarketplaceService = game:GetService("MarketplaceService")
local gamepass_id = 19037029
local template = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame.Template
game.Players.PlayerAdded:Connect(function(player)
if MarketplaceService:UserOwnsGamePassAsync(player, gamepass_id) then
local clonetemplate = template:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(plr,id,purchased)
if purchased and gamepass_id == id then
local clonetemplate = template:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local id = 19037029
local template = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame.Template
local clonetemplate = template
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,id,purchased)
if purchased and id == id then
clonetemplate:Clone()
clonetemplate.Parent = game.Workspace.Thanks.SurfaceGui.Frame.ScrollingFrame
clonetemplate.Text1.Text = "ππ"..plr.Name.."ππ"
end
end)
end)