Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a vehicle only driveable by people with a certain gamepass?

Question 1: How do i make a certain team open something Question 2: How to make a vehicle only driveable by people with a certain gamepass?

I am making a border game and i want a certain team to open the border not like anyone could open the border. So i need help on that.

Second question is how do i make a car only driveable by the people who owns the gamepass. Also need help on this.

1 answer

✓ Accepted answer

You can use UserOwnsGamePassAsync. I didn't try this:

function Change() -- The function
if workspace.Seat.Occupant ~= nil then -- Checks if the Occupant is not nil aka. nothing
local Player = game:GetService("Players"):FindFirstChild(workspace.Seat.Occupant.Parent.Name)
if Player then -- If "workspace.Seat.Occupant.Parent.Name" is found in game.Players
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 1234) then -- Checks if the player has the gamepass 1234
print("Has gamepass") -- Prints
else
workspace.Seat.Occupant.Jump = true -- Jumps the player so the player cannot sit on it.
end
end
end
end


workspace.Seat.Changed:Connect(Change) -- Using the Changed event to detect a new occupant

Sorry mod, added comments

5 comments

0

where to i put the gamepass id?

0

Line 05 - game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, GamePassID)

0

thx

0

If it works, please mark it as answered :)

0

This is really weird but i tried everything and the script does not work

This discussion is preserved as it was. New answers, comments, and votes are closed.