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

How to check what groups a player is in?

Asked by 4 years ago

In my game, I want a player to only be able to chose a certain role if they are in a specific group. How can I do this?

3 answers

Log in to vote
1
Answered by 4 years ago

It's easy, just get the player from game.Players (or from "game.Players.PlayerAdded") and then check using "PartOfGroup = Player:IsInGroup(GroupID)". The ":IsInGroup()" checks if a player is in a group then returns a true or false value (which is stored in the "PartOfGroup" variable).

If you want the documentation itself check it here: https://developer.roblox.com/en-us/api-reference/function/Player/IsInGroup

If you have any questions or issues contact me. ;)

0
Thank you for posting an actually helpful response. Vouch. DejaSketch 84 — 4y
Ad
Log in to vote
0
Answered by
zomspi 541 Moderation Voter
4 years ago

You really need to give us more info but here's what I can do with your info:

You can just use an if statement:

local player = game.Players.LocalPlayer
if player.Group == "Group" then -- change the group to your group path and change the "Group" to your group name, I highly suggest you use teams, this would make it a lot easier
role.Visible = true -- Again, change role to the path of your role
end

Please do some more research and next time give us some more information! I highly suggest you research teams and remote events, they will probably help you here! If I helped in the slightest please accept this answer!

0
You don't actually need "RemoteEvents" nor "RemoteFunctions" for this if all he wants is the server to check if a player is part of a group. He just needs to use the ":IsInGroup()" function. lazycoolboy500 597 — 4y
0
It's literally just activate something if a player is in a group. Didn't ask for you to write an entire script, I asked how to see if a player is in a group or not. DejaSketch 84 — 4y
0
Also I meant groups on the website lmao. DejaSketch 84 — 4y
0
oh sorry lol zomspi 541 — 4y
Log in to vote
0
Answered by 4 years ago

Use Player:IsInGroup

Answer this question