eazoppe
(Eazoppe)
June 1, 2020, 10:35am
#1
So I am trying to make it so the user needs to be a specific rank in the group and when I do the code below, it doesn’t work as I am about rank 1 but it still does the effect. I need help to fix this.
if plr:GetRankInGroup(4027935) == 1 then
rankUser(UserId, RoleId)
DiscordAPI("Tutorial Notification",player.Name.." has finished the Tutorial and got promoted.")
end
Where is Plr Value coming from?
What is RankUser?
what is DiscordAPI?
Can you give more information in ths code?
Did you set the lines inside a PlayerAdded
event?
>=
operators are any value from the input and above. While ==
is exactly that value.
1 Like
eazoppe
(Eazoppe)
June 1, 2020, 10:37am
#4
I had to change a bit of the code as it is to say == 1 and not >=.
eazoppe
(Eazoppe)
June 1, 2020, 10:37am
#5
Yes I have done that but it still doesn’t work.
eazoppe
(Eazoppe)
June 1, 2020, 10:38am
#6
The question am I asking doesn’t have anything with RankUser or DiscordAPI. The plr value is player.
Next question here, where did you place this script?
1 Like
eazoppe
(Eazoppe)
June 1, 2020, 10:39am
#9
A script in ServerScriptService.
Your script should work then, to check that you can Print()
Right after the group check.
Its maybe a problem with the other functions
Well then, it should have worked from the beginning unless there was an error on the console. Did you have an error in the console or no?
Also please include expected behavior of it.
1 Like
Are you testing it in Studio? It can fail to load the GetRankInGroup() in studio testing sometimes.
eazoppe
(Eazoppe)
June 1, 2020, 10:41am
#15
No, I have tested it in studio and in game.
How is the Plr called?
How do you get the player?
I suggest provide the full code (not including functions) so we can give you more support.
eazoppe
(Eazoppe)
June 1, 2020, 10:44am
#18
I might’ve found the problem but I am testing it now.
1 Like
Are you getting any errors in output from that line?
eazoppe
(Eazoppe)
June 1, 2020, 10:51am
#20
Ok so I got the error. This is the error.
That means that plr is nil, and therefore :GetRankInGroup() cannot be called. Where are you getting plr from?
eazoppe
(Eazoppe)
June 1, 2020, 10:53am
#22
local plr = game.Players.LocalPlayer