For future reference, it makes your code much easier to read if you use the codeblock feature and properly indent and separate your code.
Game Passes work differently than other assets now and you need to use the new API for new game passes.
You'd pass in a call like this:
MarketplaceService:UserOwnsGamePassAsync(LocalPlayer.UserId, GamePassId).
Additionally, the client cannot access game.ServerStorage.
You are checking if any part with a humanoid touched the part, but that's not what you want, because other NPCs or players could touch the part.
For future reference, just call game.Players:GetPlayerFromCharacter(TouchedPart.Parent) to attempt to find the player (though it can be nil, so return if it is). Use either that or the Humanoid.Touched event for this, and make sure that you only listen for the local player touching the part.
RBXScriptSignal:connect() is deprecated, prefer RBXScriptSignal:Connect().
1 comment
You can’t access ServerStorage in a localscript. If you’re using a server script though, it still won’t work as you can’t use LocalPlayer.