There are four things wrong with your code.
Let's go over them in order, from the simplest to the less obvious to fix.
First of all, there is a missing end keyword to close the if statement.
Secondly, you are trying to call methods IsInGroup and GetRoleInGroup on the Players service, the service responsible for holding Player objects. You want to call them on a Player object, a specific player.
Third, you are calling IsInGroup, but you never "capture" its return value in a variable and use it in an if statement. In other words, you ask whether the player is in a specific group, but you don't "listen" or "care" about the answer; so the only condition being checked is whether or not the role of the player is equal to "265".
This one is a logic issue. Adding the missing if statement will fix this:
local groupId = 2723362
if player:IsInGroup(groupId) then
if player:GetRoleInGroup(groupId) >= requiredRank then
end
end
Or, using the and operator, one could shorten it to a single if statement:
local groupId = 2723362
if player:IsInGroup(groupId) and player:GetRoleInGroup(groupId) >= requiredRank then
end
Finally, you check whether the return value of a call to GetRoleInGroup(2723362) is equal to "265", which, if we look at the Roblox Wiki page for GetRoleInGroup does not make sense, as it returns the "role" or "title" of the player as a string -- unless, for some very odd reason, your group's roles are numbers.
I am thinking you meant to call GetRankInGroup(2723362), which instead would return a number that corresponds to the "hierarchical position" of the player's role within the group. But even if you did use this instead of GetRoleInGroup, the following comparison to "265" wouldn't make sense, as the Wiki tells us the return value of GetRankInGroup is a number between 0 and 255, whereas you are comparing it to the string value "265".
Conclusion
Sure, there are a lot of little mistakes to fix, but don't worry, you'll eventually get the hang of it.
Anyway, I hope this helped. If it did then please be sure to accept, and optionally upvote, my answer. It helps both of us. ;) If you need anything else, you need only ask.
2 comments
Why is roblox telling me player and requiredRank unknown?????? Please help
don't just copy and paste the script