Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Game pass script isn't working, can someone show me the correct way to do it and explain?

Asked by 8 years ago
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?

2 answers

Log in to vote
0
Answered by 8 years ago

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"
Ad
Log in to vote
0
Answered by 8 years ago

Not 100% sure but i think that you need to add rbxassetid:// before the id rbxassetid://379480149

Answer this question