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

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

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"

1 comment

0

Help!

1 answer

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)

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