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 4 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:

script.Parent.Touched:Connect(function()

    if game.Players.LocalPlayer.Name == "UsernameHere" then

        script.Parent.CanCollide = false

    else

        script.Parent.CanCollide = true
    end

end)
0
I changed my script. have a look kingblaze_1000 359 — 4y

2 answers

Log in to vote
1
Answered by
Nanomatics 1160 Moderation Voter
4 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:

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

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 — 4y
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 — 4y
0
I put the script in the parent, and do you mean localscript? Or just a normal script? GodsGraceSavesAll 6 — 4y
0
Normal script, this should be in a normal script Nanomatics 1160 — 4y
View all comments (3 more)
0
Okay GodsGraceSavesAll 6 — 4y
0
It worked, thanks! GodsGraceSavesAll 6 — 4y
0
Happy to help :) Nanomatics 1160 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
game.Players.PlayerAdded:Connect(function(player)
    -- just see if player is high enough rank 
    if player:GetRoleInGroup(group ID goes here) == ("Name of rank") then
        script.Parent.CanCollide = false
    else
        script.Parent.CanCollide = true
    end 
end)
0
And what do I put in that "is high enough rank" string? GodsGraceSavesAll 6 — 4y

Answer this question