local Players = game:GetService("Players") local Market = game:GetService("MarketplaceService") local PassId = 463912717 Players.PlayerAdded:connect(function(User) if (Market:PlayerOwnsAsset(User ,PassId)) then game.ServerStorage.ScreenGui:Clone game.ServerStorage.ScreenGui.Parent=User.PlayerGui end end end)
This is how I usually do it:
game.Players.PlayerAdded:connect(function(player) if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 0) -- 0 is the gamepass id print(player.Name.." owns the gamepass.") local h = game. ServerStorage['YOUR GUI']:Clone() h.Parent = player.PlayerGui print('Done!') end end)
Hopefully that helps you out!
**Thanks, ****TopRiot
You did not define a variable for the cloned object.
local Players = game:GetService("Players") local Market = game:GetService("MarketplaceService") local PassId = 463912717 Players.PlayerAdded:connect(function(User) if (Market:PlayerOwnsAsset(User ,PassId)) then local clone = game.ServerStorage.ScreenGui:clone() clone.Parent=User.PlayerGui end end end)