I would like to know how to kick a player out of a vehicle if they have not bought the gamepass. I have a script but it is not working.

local passId = 724039726 -- 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

You could take the easy way out and ban them from your game if you have proof of them hacking

0

true