Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does it output "Attempt to compare number with string"?

Asked by
Nidoxs 190
8 years ago

Here is the bit that it gives the out put on.


Tool.Equipped:connect(function(mouse) if player:IsInGroup(2608221)then if player:GetRoleInGroup(2608221) > 1 then AnimTrack2:Play() end

2 answers

Log in to vote
0
Answered by
Nickoakz 231 Moderation Voter
8 years ago

http://wiki.roblox.com/index.php?title=GetRoleInGroup

GetRoleInGroup returns the name of the rank. Like if the user is not in the group, it would be 'Guest'

So you are using a string against a number, instead use.

http://wiki.roblox.com/index.php?title=API:Class/Player/GetRankInGroup

That will return a number..

Ad
Log in to vote
0
Answered by 8 years ago

Because "GetRoleInGroup" returns the string value of the role. And you're comparing it to a numerical value of 1 using the greater than symbol.

Answer this question