I know how to make a script for if a player has a gamepass, but The problem is, if the player joins the server then buys the gamepass from the webpage, and the script checks for the gamepass when you join the server, and they rejoin but still says they don't have it, how do you fix that? Sorry if you don't understand.
I'm assuming you're using PlayerHasPass. The issue with this is the fact that the method caches, which leads to what you've described - In terms of, if they leave and come back or if you're checking multiple times whilst they're ingame. The best way around this is using MarketplaceService's PlayerOwnsAssets method.