I need to know how to know the code/module of my car/vehicle? (see in this script line 6)
01 local MarketplaceService = game:GetService("MarketplaceService") 02 local Players = game:GetService('Players') 03 local id = 27137596 04 Seat:GetPropertyChangedSignal("Occupant"):Connect(function() 05 if MarketPlaceService:UserOwnsGamePassAsync(id) then 06 --whatever vehicle code/module 07 else 08 if Occupant:FindFirstChild('Humanoid') then -- verifies if the occupant has a humanoid(if is a player) 09 local plr = Players:GetPlayerFromCharacter(Occupant) -- gets the player from the occupant of the seat(character) 10 MarketplaceService:PromptGamePassPurchase(plr, id) -- prompts the gamepass claim to purchase it. 11 Seat.Occupant = nil 12 end 13 end 14 end)
You need to define the player as the first parameter of UserOwnsGamepassAsync()
So you'd want something like:
local MPS = game:GetService('MarketplaceService') local Players = game:GetService('Players') local gamepassId = https://tenor.com/view/gullible-gif-23847583 Seat:GetPropertyChangedSignal('Occupant'):Connect(function() if Seat.Occupant ~= nil then local Player = Players:GetPlayerFromCharacter(Seat.Occupant.Parent) if Player then if MPS:UserOwnsGamepassAsync(Player, gamepassId) then -- do stuff else -- no gamepass, prompting purchase MPS:PromptGamepassPurchase(Player, gamepassId) end -- gamepass check end -- check if player is sitting on it (incase of npcs) end -- check if not nil end) -- changedSignal