LocalScript inside StarterGui
Checks if the player has game pass and then does the thing, but only works when player resets and not when he joins the game
So if you bought a game pass ( gear ) left the game, rejoined It wouldn't give it to you unless you reset.
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local player = game.Players.LocalPlayer local GamePassID = 7411543 function onCharacterLoaded(Character) local check = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassID) if check then print("this should print when the player joins, but it doesn't pls help") end end player:GetPropertyChangedSignal("Character"):Connect(onCharacterLoaded)
Again it works when player resets and that good, but not when the player joins.
First, your script is a local script since it has ".LocalPlayer" you'd want a server-sided script instead. Second, get the player when he enters and their character when it spawns
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") --local player = game.Players.LocalPlayer local GamePassID = 7411543 Players.PlayerAdded:Connect(function(plr) -- this gets the player (for a script and local but I would do script) plr.CharacterAdded:Connect(function(character) -- When a character is added, the argument is followed up by the variable "character" local check = MarketplaceService:UserOwnsGamePassAsync(plr.UserId, GamePassID) if check then print("this should print when the player joins, but it doesn't pls help") end end) end)