Hello.
I have made these basic cars, that use a vehicle seat and some parts.
How would I make the cars so that only people who have a gamepass can use them?
Hello.
I have made these basic cars, that use a vehicle seat and some parts.
How would I make the cars so that only people who have a gamepass can use them?
This should work but Im not sure because I used this a long time ago.
local GamepassID = 16071233 --your id here
local MarketplaceService = game:GetService("MarketplaceService")
script.Parent.ChildAdded:connect(function(child)
if child.Name == "SeatWeld" then
local Player = game.Players:GetPlayerFromCharacter(script.Parent.SeatWeld.Part1.Parent)
if not MarketplaceService:UserOwnsGamePassAsync(Player.userId, GamepassID) then
print("not Allowed")
wait(0.00001)
child:Destroy()
child.Part1.Parent.Humanoid.Jump = true
else
print("allowed")
end
end
end)
Put this inside the Seat as a Script.
Use an attribute or StringValue and set the owner’s name to its value. If the occupant is not the owner, kill them or whatever
Gamepass only cars if I understood correctly?
Add a script in the Vehicleseat in this case and basically do something like this
GetPropertyChangedSignal
on the Occupant of the seat and connect it to an eventnil
?game.Players:GetPlayerFromCharacter(human.Parent)
where human
is the occupant of the seatUserOwnsGamePassAsync
like how @ShyFlooo mentioned and if they don’t own the gamepass, make them jump off or kill them, depending on what you wanna doI wouldn’t recommend using a premade script as it doesn’t help you improve your scripting skills