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

Script that makes a player jump out of vehicle seat if they don't have a certain game pass?

Im making a racing game and want to have cars that you're required to have a gampass to drive so how would I make it possible so that if the player doesn't have the gamepass, the script would make the player jump out of the car.

1 answer

Try this

local passId = 0000000 -- change this to your game pass ID.
 
function isAuthenticated(player) -- checks to see if the player owns your pass
	return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
 
script.Parent.VehicleSeat.ChildAdded:connect(function(obj)
	if game.Players:FindFirstChild(obj.Part1.Name) then
		plr = game.Players:FindFirstChild(obj.Part1.Name)
	end

	if plr and not isAuthenticated(plr) then
		plr.Character.Humanoid.Jump = true
		print(plr.Name.." is not authorized to use this vehicle")
	end
end)

2 comments

0

To note, half of this is from the WIKI, I just made modification ( http://wiki.roblox.com/index.php?title=Game_Pass )

0

I tried but I didn't really understand it haha, i'll tell you if it works during beta.

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