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

need some help because i'm a starter?

Asked by 2 years ago

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)

0
Dude, try watching a tutorial or something before asking here, if that doesn't work than come back here and ask TheStageGuyYT 19 — 2y
0
@TheStageGuyYT I already searched and watched for hours and I didn't help so I post it here rollonthebeat 1 — 2y

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
2 years ago

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
0
this is such a sad answer greatneil80 2647 — 2y
0
It didn't helped my I need to know in my script line 6 how can i know the module/code of the car rollonthebeat 1 — 2y
Ad

Answer this question