What is wrong here? Im trying to make a gui appear when they have a gamepass?
game.Players.PlayerAdded:connect(function(plr)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,408836915) then
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
else
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
end
end)
Im not sure that ive dont this right but i checked the wiki.

3 comments
Is FE on? And is this in a server script? If this is in a server script with FE on, scripts can't access PlayerGui or LocalPlayer. If this is in a local script, there's no point in a Player Added function.
you can only use game.Players.LocalPlayer in a local script. yet you can only use game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,408836915) in a regular script. and game.Players.PlayerAdded:connect(function(plr) should only be used on the server.
Is it a server script. It wont work if its a server script, and its completely fine to put this in a local script, fe doesnt really change anything and playeradded works on local scripts too.