Should I wrap this in pcall?

I wanna know if I should wrap this in a pcall

Players:CreateHumanoidModelFromUserId(userId)
1 Like

Depends where userId is coming from, if it is from player input you likely should.

3 Likes

Its from the datastore the userId %100 exists

Then you don’t need to wrap it in pcall.

3 Likes

any part of code that you know may error, like HTTP or Datastore based methods, you should always wrap them in a pcall and error handle them accordingly

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.