local passId = 379480149 function isAuthenticated(player) 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)
I put this script into the seat of the vehicle which is named Drive, and the id is correct and I'm sure of that. Though when i try to test it with someone who doesn't have the pass, they can still drive it and they don't jump out. I tried multiple ways to do it and still. I tried to find the problem, but couldn't find it. Although "plr" on line 7 is underlined in blue. Can anyone help?
ROBLOX does not automatically insert rbxassetid://
into the IDs once the game loads, therefore you will have to add rbxassetid://
(as said above) to the id. Be sure to put quotes in there as well, or it will error. This happens because there is no 379480149/
file on the ROBLOX servers, it is rbxassetid://379480149
.
Replace line 1 with:
local passId = "rbxassetid://379480149"
If that does not work, try
local passId = "www.roblox.com/asset?id=379480149"
Not 100% sure but i think that you need to add rbxassetid://
before the id rbxassetid://379480149