Skip to content

Update GetRankInGroup to GetRankInGroupAsync#54

Open
ImFirstPlace wants to merge 1 commit into
Epix-Incorporated:masterfrom
ImFirstPlace:other/update-getrankingroup-to-async
Open

Update GetRankInGroup to GetRankInGroupAsync#54
ImFirstPlace wants to merge 1 commit into
Epix-Incorporated:masterfrom
ImFirstPlace:other/update-getrankingroup-to-async

Conversation

@ImFirstPlace

Copy link
Copy Markdown
Contributor
  • Update GetRankInGroup to GetRankInGroupAsync

@GalacticInspired

Copy link
Copy Markdown
Member

WHat

@coasterteam coasterteam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to update this, might as well do a little improvement alongside it.

local plr = Players:GetPlayerByUserId(textSource.UserId)

if plr:IsInGroup(GroupID) and plr:GetRankInGroup(GroupID) == RankID then
if plr:IsInGroup(GroupID) and plr:GetRankInGroupAsync(GroupID) == RankID then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably wrap these in a pcall that won't break the script should it decides to error.

if localplayer:IsInGroup(group) then
for _, v in pairs(ranks) do
if localplayer:GetRankInGroup(group) == v then
if localplayer:GetRankInGroupAsync(group) == v then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here, wrap the Async method inside a pcall

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about IsInGroup?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditch the IsInGroup check in my opinion, pcall the GetRankInGroupAsync method prior to the loop and cache the rank value in a variable; default to 0 if it doesn't succeed of course, go from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants