Hello, I was going through roblox dev page reading about gamepasses then i came across a syntax which i did not understand but have seen it in many places. Can anyone pls explain me note that the below code is an example, i have seen it in many places the main part where i have doubt is the 'local success, message' part and also the pcall function can anyone pls explain me?
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
end)
Thanks in advance, ayazi10

1 comment
Basically it calls the function, except if there is an error in the function, it wont stop the whole script because of the error. Instead, it will return success and the errorMessage. Success is a bool value, and if it is true, then the code inside the function ran without any errors. If success is false, it will also return an errorMessage, which is the error you would usually get (as a string)