#when to use pcall

1 messages · Page 1 of 1 (latest)

charred widget
#

so from what i understood pcall runs a part of the script without interrupting the main script, it returns two values, success and error so u know if that part executed correctly. In what situations is this useful?

gentle pagoda
#

or like roblox services that error alot

lofty wraith
#

people usually use it for :ComputePath

charred widget
lofty wraith
#

you could also use it to find hacker that send values trough remote events by tring to access an object property in a Pcall, if it fails then it mean the object is not what it's supposed to be so you can kick him without halting the whole script

gentle pagoda
#

ur doing too much

#

https://devforum.roblox.com/t/pcalls-when-and-how-to-use-them/393687
@charred widget this will help if you're still confused

charred widget
#

i mean i understood the basics just need to see when i can use it ill try some scripts in these days

gentle pagoda
#

you use it in that alot

#

you can also make retry loops with that

charred widget
#

at first i was like why should i use pcall if i can fix the script if theres an error but sometimes its roblox that makes errors

gentle pagoda
#

yep exactly

charred widget
#

so useful for things like these