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

It says that my Pass ID is a decal even though its obviously a game pass?

Asked by 2 years ago

Please help it says

(I did it in a script so nothing happens to it)

GamePassId '20584484' is not of type Game Pass. Please use MarketplaceService:PlayerOwnsAsset instead.

This is my Script:

local PassID = 20584484


local seat = script.Parent

function auth(plr)
    return game:GetService("GamePassService"):PlayerHasPass(plr, PassID)
end 
function OnTouched(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
        if  auth(game.Players:GetPlayerFromCharacter(hit.Parent)) then
            seat.Transparency = 0
        else hit.Parent.Humanoid.Health = 0
            script.SeatKickGui.Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad)
        end end end
seat.Touched:connect(OnTouched)

And I triple checked my pass and it's type and it says "Pass"

0
Help! poppyloverb 20 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

I believe it is because PlayerHasPass is deprecated. There is a new function called PlayerOwnsAsset that does the same thing.

I changed the code for you. This should work

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset
local PassID = 20584484


local seat = script.Parent

function auth(plr)
    local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, plr, PassID)
end 
function OnTouched(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
        if  auth(game.Players:GetPlayerFromCharacter(hit.Parent)) then
            seat.Transparency = 0
        else hit.Parent.Humanoid.Health = 0
            script.SeatKickGui.Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad)
        end end end
seat.Touched:connect(OnTouched)
Ad

Answer this question