How could I create a script that would allow only a user with a certain owned gamepass to drive a vehicle?
5 Likes
Use this code in a server script:
local MarketplaceService = game:GetService("MarketplaceService")
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if MarketplaceService:UserOwnsGamePassAsync(GamePassID) then
--whatever vehicle code/module
else
Seat.Occupant.Sit = false
end
end)
The GamePassID
can be found in the URL of the gamepass. For example, VIP from adopt me (VIP - Roblox) would have an id of 3196348.
8 Likes
Much appreciated!
1 Like