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

Error on this gamepass checking script, is not a valid member of player Help me?

local owns = game:GetService("MarketplaceService"):PlayerOwnsAsset(game.Players[script.Parent.Parent.UsernameInput.Text].UserId, 1107385689)

script.Parent.MouseButton1Click:Connect(function()
	if owns then
		script.Parent.Parent.GPStatus.Text = "Gamepass Status: User has the Suite gamepass"
		wait(3)
		script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
	else
		script.Parent.Parent.GPStatus.Text = "Gamepass Status: User doesn't have the suite gamepass."
		wait(3)
		script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
	end
end)


these few days there has been something wrong with my scripting skills and i cant think straight help me?

2 comments

0

paste the whole error please

0

What

1 answer

✓ Accepted answer

###Game passes are no longer assets. They are their own ID, formatted like this:

https://www.roblox.com/game-pass/idhere/passnamehere

###A fix is to use the UserOwnsGamePassAsync method.

local player = game:GetService("Players").LocalPlayer
local owns = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[script.Parent.Parent.UsernameInput.Text].UserId, 1107385689)

script.Parent.Activated:Connect(function(inputObject)
    if owns then
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: User has the Suite gamepass"
        wait(3)
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
    else
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: User doesn't have the suite gamepass."
        wait(3)
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
    end
end)



1 comment

1

Thanks! I'm guessing roblox just made this recently since I took a few months break. What a time waster, anyways thanks!

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