how to specify in a script that we want to talk about a specific object? see line 6 I don't know how to specify the vehicle?? I am trying to make a car gamepass that kicks you out and spawn the pass so you can buy it?
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService('Players')
local id = 27137596
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if MarketPlaceService:UserOwnsGamePassAsync(id) then
--whatever vehicle code/module
else
if Occupant:FindFirstChild('Humanoid') then -- verifies if the occupant has a humanoid(if is a player)
local plr = Players:GetPlayerFromCharacter(Occupant) -- gets the player from the occupant of the seat(character)
MarketplaceService:PromptGamePassPurchase(plr, id) -- prompts the gamepass claim to purchase it.
Seat.Occupant = nil
end
end
end)

4 comments
Could you explain a bit more in-depth what you're trying to do?
Because line 6 specifies a game pass, not an instance.
are you asking how if check if a player owns a gamepass or what?
@AronYstad im trying to make a car gamepass that kicks you out and spawn the pass to buy if you don't own the pass