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

How would I make a grouprank locked gate?

Asked by
dxrrevn 13
2 years ago
Edited 2 years ago

I'm making a gate for my school group (ID: 5081986), and need only Ranks 255, 253, 250, 249, 190 and 8 to open it. Ranks 0, 1, 2, 3, 4, 5, 12, 13, 16, 100, 104, 120 cannot open it. The part names are GateClosed (workspace.GateClosed) [VISIBLE AT START] and GateOpen (workspace.GateOpen) [INVISIBLE AT START]. It would be good if the cancollide could be done as well.

Any help is appreciated, thanks!

[EDIT] ClickDetectors would work well, as well as a close gate function.

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

First of all, remember to at least try some sort of script before asking on this website, scriptinghelpers.org is not a request site.

So, here's the script I made. The comments should be able to help you understand what's happening.

Oh yeah, and put this in a LocalScript.

wait(5) -- Just to make sure everything we need has finished loading in

game.Workspace.GateClosed.Visible = true -- Make the GateClosed instance visible
game.Workspace.GateClosed.CanCollide = true -- Don't let the player walk through
game.Workspace.GateOpen.Visible = false -- Make the GateOpen instance invisble
game.Workspace.GateOpen.CanCollide = true -- Don't let the player walk through

local plr = game.Players.LocalPlayer -- The client
local groupId = 5081986 -- Specify the ID of the group to be checked
local groupRank = plr:GetRankInGroup(groupId) -- Get the group rank of the player (does not need to check if player has joined the group)

if groupRank == 255 or 253 or 250 or 249 or 190 or 8 then -- If the player has one of these ranks, then it will let the players go through
    game.Workspace.GateClosed.Visible = false -- Make the GateClosed instance invisible
    game.Workspace.GateClosed.CanCollide = false -- Let players walk through

    game.Workspace.GateOpen.Visible = true -- Make the GateOpen instance visible
    game.Workspace.GateOpen.CanCollide = false -- Make sure these players can walk through

    print("User "..plr.Name.." is in the group! Their rank in the group is "..groupRank)
else -- If they don't have any of those ranks, or if they aren't in the group
    game.Workspace.GateClosed.Visible = true -- Make the GateClosed instance visible
    game.Workspace.GateClosed.CanCollide = true -- Don't let the player walk through
    print("User "..plr.Name.." is not in the group. :(")
end
0
@PaleNoobs thanks for the answer, i was ideally thinking with a click detector, but i forgot to add that in the description, would that be amendable on the current script dxrrevn 13 — 2y
0
Also, a close gate function was also what I was looking for but forgot to add. dxrrevn 13 — 2y
Ad

Answer this question