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

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

Asked by 7 years ago

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)
0
what auth(plr) does? edugamer9999 15 — 7y
0
Function to "authenticate" if they have the gamepass or not. ManOfTrust32 0 — 7y

1 answer

Log in to vote
0
Answered by
j5707r -36
6 years ago

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.

Ad

Answer this question