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

Trying to get a gamepass car to work and this won't?

I've almost got it and came down to this code but for some reason it still won't work.

local seat = script.Parent
local PassID = --Gamepass ID here
 
function auth(plr)
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(plr, PassID)
end
 
function OnTouched(hit)
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent);
    if plr then
        if auth(plr) then
            seat.Transparency = 0
        else
            hit.Parent.Humanoid.Health = 0
        end
    end
end
 
seat.Touched:Connect(OnTouched)

2 comments

0

what auth(plr) does?

0

Function to "authenticate" if they have the gamepass or not.

1 answer

Where it says hit.Parent.Humanoid,Health, change it to this:

hit.Parent.Humanoid.Health = Humanoid.Health - 110

That is one error I see in this.

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