Recently,
I’ve seen a post about a service which certinaly requires pcalls,
and the solutions I saw there, were totally bad practice which could cause issues to player’s game when the web is down. And it really bothers me, simply because it’s 2022 and people still use bad practice. Why is that? I really want to know why people dont want to use a better and safer method, I understand they’re used and think it’s easier, but no - using pcalls is even easier than you think.
Now, I accept the reasons:
1.Easier to use.
2.Used to it.
3.Looks ‘neater’.
etc…
But afterall, the reason pcalls are there is to help your game handle data and stuff incase the web is down. And my question is - why’d you want to avoid such a magnificent & powerful tool?
In the past, when I didnt know about pcalls, I later on saw errors occurring very often [ the data store and scripts were 100% correct, but apparently they were bad practice.] And since I got used to pcalls, I am still amazed and still use them in every script there is anything related to the web and could potentially fail due to issues.
So back then I used to do:
if game.BadgeService:UserHasBadgeAsync(UserId,BadgeId) then end
if game.MarketplaceService:UserOwnsGamePassAsync(UserId,GamepassId) then end
if data then end -- data isnt wrapped in a pcall here
And after long time, I finally learned that this is an atrocious practice which you should avoid using. And then I started using pcalls - and they are awesome!
Importance of pcalls:
What are pcalls - and how to use them
Why should I use pcalls?
Is it good to use pcalls? And When?
Why did I make this post?
1.To hopefully raise the awareness of how important pcalls are.[examples could be shown above, linked them].
2.To hear others opinions on this topic and to see how/if using pcalls have affected you so far.
- Yes.
- Nah.
0 voters