What is wrong with these scripts?

I was making a gamepass GUI and it is not working so I was wondering if it was the scripts that were not working.

Any help is appreciated (Sorry if the screenshots are not clear)

I’m new to scripting so i’m most likely wrong, but i think you forgot to put “local” before the first instance of hasPass.

You capitalized the s in swordGamepassID too.
nvm, this new font is confusing my eyes…

edit: It’s also much easier to copy and paste your code like this

print('hi')

Then to include screenshots, so we can quote your code!

Lemme just give you this: Passes | Roblox Creator Documentation

For one thing, I think you’ve misspelled the method name. It should be referred to as :UserOwnsGamePassAsync, but you’ve added an e at the end. (probably a typo?)

Another thing here, is instead of making hasPass global, you could define it outside of your pcall as a local variable you could assign to instead. Example:

local hasPass;

pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, swordgamepassID) end)

if hasPass then
--//do stuff
end
1 Like

Need. To. Practice. Capitalization. Practice. Spelling. Make sure you use capitalization, and practice camel case and snake case. Just in case you don’t know: Snake case - Wikipedia

sword

Your original naming of this goes

swordgamepassID

but you did:

swordGamepassID

Keep an eye on capitalization Eugh hard to spell capitalization

This error means that your trying to reference an object that doesn’t exist.


swordgamepassFrame simply doesn’t exist inside MainFrame

Thank you all for the help I will try and fix it.