Help! How do I use 'GetGroupsAsync' in a group rank door? Could someone please help? Thanks!! :D
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
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.
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?