Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Car gamepass that kicks you out and that pop up the gamepass to buy it?

Asked by 2 years ago

Can someone help my I made a car gamepass but it don't know how to code the kicker and the pop up?

I can use this 1 but i don't know how to find the "code/module of my car" can you help me guys?

local MarketplaceService = game:GetService("MarketplaceService")
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    if MarketPlaceService:UserOwnsGamePassAsync(27137596) then
         --whatever vehicle code/module
    else
        Seat.Occupant.Sit = false
    end
end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

The only thing you need is, make a function(which the service already has it) to pop up the claim to buy the gamepass called :PromptGamePassPruchase(player, id); copy & paste this inside you script(I added some changes to 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)
0
thank you so much, you are a legend rollonthebeat 1 — 2y
0
can you say me how to know the module/code of my car because i don't know? Im a beginner in lua for roblox. And im very bad at scripting rollonthebeat 1 — 2y
0
You should put whatever starts the function of the car, but I'm not really sure what should be there because I don't where is you module in your game and how it works. Sarturex857 109 — 2y
Ad

Answer this question