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

GetGroupsAsync in group rank door. Help please! ? [closed]

Asked by 6 years ago
Edited 6 years ago

Help! How do I use 'GetGroupsAsync' in a group rank door? Could someone please help? Thanks!! :D

0
Use Player:IsInGroup(<group id>) herrtt 387 — 6y
0
If it helps, I answered a question a while ago with using the GroupService. :) https://scriptinghelpers.org/questions/59914/rank-gui-not-displaying-ranks#58290 TheeDeathCaster 2368 — 6y

Closed as Not Constructive by User#19524

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
-1
Answered by
herrtt 387 Moderation Voter
6 years ago
local groupid = <groupid> —Change to the groupid

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        if plr:IsInGroup(groupid) then
              local grouprank = plr:GetRankInGroup(groupid)
              —This will check if the player is in the group and get their group id
              if grouprank >= 1 then
                  print("Player is rank: "..grouprank)
              end
              script.Parent.CanCollide = false
              script.Parent.Transparency = 0.5
              wait(0.5)
              script.Parent.CanCollide = true
              script.Parent.Transparency = 0
        end
    end
end)

Just put this inside the part/door you want to be hidden and open when a player that is in the group touches

0
Don't spoon feed User#19524 175 — 6y
Ad
Log in to vote
-1
Answered by
popeeyy 493 Moderation Voter
6 years ago

For you to use "GetGroupsAsync", I've made a module for all ROBLOX users that want an easy way to do this! https://www.roblox.com/library/1693869984/ROBLOX-Player-Group-Module-REDONE

Here's how it would work in your code, which would be under the door:

local group = 0 --Change to the groupID
local rank = 0 --Change to the min rankID
local GM = require(01693864088)
local killDoor = false --Kill when the player touches and it not the correct rank.

script.Parent.Touched:connect(function(part)
    if part.Parent and part.Parent:FindFirstChild('Humanoid') then
        local plr = game.Players:GetPlayerFromCharacter(part.Parent)
        if plr then
            if GM:GetRankInGroup(plr, group) >= rank then
                script.Parent.CanCollide = false
                wait(1)
                script.Parent.CanCollide = true
            elseif killDoor then
                part.Parent.Humanoid.Health = 0
            end
        end
    end
end)

Just change the group and rank value.

0
Ew deprecated code and spoon feeding User#19524 175 — 6y