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

How would I make a wall that lets certain ranked people from a group through?

Asked by 5 years ago

I wanted to make a wall that'd let only a certain rank go through.

This is what i've tried but idk how to define a group role:

01script.Parent.Touched:Connect(function()
02 
03    if game.Players.LocalPlayer.Name == "UsernameHere" then
04 
05        script.Parent.CanCollide = false
06 
07    else
08 
09        script.Parent.CanCollide = true
10    end
11 
12end)
0
I changed my script. have a look kingblaze_1000 359 — 5y

2 answers

Log in to vote
1
Answered by
Nanomatics 1160 Moderation Voter
5 years ago

Group ranks are ranged from 1-255, so what you need to do is check if the player's rank is bigger than or equal to the rank you want and then run the code.

You can do that through a function called GetRankInGroup which is a function of a player object.

Example:

01script.Parent.Touched:Connect(function(hit)
02    if hit.Parent:FindFirstChild("Humanoid") then -- check if what touched is a character
03        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
04        if player:GetRankInGroup(groupIdHere) >= 20 then -- replace 20 with rank number you want
05            script.Parent.CanCollide = false
06        else
07            script.Parent.CanCollide = true
08        end
09    end
10end)

Hope I helped, if you have any questions please let me know

0
It doesnt appear to work, I put the group id and the rank number and it still wouldn't let me thorugh. GodsGraceSavesAll 6 — 5y
0
I am assuming this script is parented to the part that gets touched (the door)? And did you put this in a serverscript? Nanomatics 1160 — 5y
0
I put the script in the parent, and do you mean localscript? Or just a normal script? GodsGraceSavesAll 6 — 5y
0
Normal script, this should be in a normal script Nanomatics 1160 — 5y
View all comments (3 more)
0
Okay GodsGraceSavesAll 6 — 5y
0
It worked, thanks! GodsGraceSavesAll 6 — 5y
0
Happy to help :) Nanomatics 1160 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
1game.Players.PlayerAdded:Connect(function(player)
2    -- just see if player is high enough rank
3    if player:GetRoleInGroup(group ID goes here) == ("Name of rank") then
4        script.Parent.CanCollide = false
5    else
6        script.Parent.CanCollide = true
7    end
8end)
0
And what do I put in that "is high enough rank" string? GodsGraceSavesAll 6 — 5y

Answer this question