Well if the players had to buy a gamepass, you don't need to save them or anything, just check if they own the gamepass. We're going to use the PlayerAdded event for this one.
01 | local GAMEPASS_ID = 123 |
02 | local marketplaceService = game:GetService( "MarketplaceService" ) |
03 | local gravityCoil = game.ServerStorage.Tools.GravityCoil |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 | player.CharacterAdded:Connect( function (character) |
07 | if marketplaceService:PlayerOwnsAsset(player, GAMEPASS_ID) then |
08 | gravityCoil:Clone().Parent = player.Backpack |
We don't need to save the GravityCoil inside the player, we can just put it inside of ServerStorage. You can also clone to StarterGear if you'd like. I just chose this way as an easy method of allowing the player to buy the gamepass when they're in-game and still get the coil when they respawn, but there are other ways to do that.