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.
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