#Group Only Door.

1 messages · Page 1 of 1 (latest)

upper beacon
#

local Player = game.Players.LocalPlayer
local doorPart = game.Workspace.Barriers.OwnerPC
local groupId = 10219067 (Removed 2 numbers to make my group private)
local minimumRank = 254

if Player:GetRankInGroup(groupId) >= minimumRank then
print("Player is at or above minimum rank")
doorPart.CanCollide = false
else
print("Player is below minimum rank")
doorPart.CanCollide = true
end
My script isnt working ^^
This script I put in Starter GUI as a LocalScript.

#

It works sometimes, but other times it doesnt.

#

Its almost like it needs a delay or something.

#

I THINK I may have gotten it.

#

But I want more of a pro to make sure I found the solution LOL

#

local doorPart = game.Workspace.Barriers:WaitForChild("OwnerPC")

neat narwhal
#

yeah it should be fixed

upper beacon
#

Awesome, thanks!

neat narwhal
#

also you can just use workspace instead of game.Workspace

upper beacon
grim ventureBOT
#

studio** You are now Level 1! **studio

neat narwhal
#

you can do something like this

local Player = game.Players.LocalPlayer
local barriers = workspace:WaitForChild("Barriers")
local groupId = 10219067
local minimumRank = 254

local function setBarriersEnabled(enabled: boolean)
    for i, part in barriers:GetDescendants() do
        if part:IsA("BasePart") then
            part.CanCollide = enabled
        end
    end
end

if Player:GetRankInGroup(groupId) >= minimumRank then
    print("Player is at or above minimum rank")
    setBarriersEnabled(false)
else
    print("Player is below minimum rank")
    setBarriersEnabled(true)
end
zenith marsh
#

they are not that hard

#
for _, barrier in pathToBarriersModel do
    --here you can put code that will be executed for every barrier
end
upper beacon
zenith marsh
#

your gonna figure them outThumbs

upper beacon
#

If you have a youtube video or anything to help me, that would be great.

#

local Player = game.Players.LocalPlayer
local doorModel = game.Workspace.Barriers
local groupId = 10216067
local minimumRank = 254

for _, part in ipairs(doorModel:GetChildren()) do
if part:IsA("BasePart") then
if Player:GetRankInGroup(groupId) >= minimumRank then
print("Player is at or above minimum rank")
part.CanCollide = false
else
print("Player is below minimum rank")
part.CanCollide = true
end
end
end

Did not work.

median sparrow
# upper beacon local Player = game.Players.LocalPlayer local doorModel = game.Workspace.Barrier...

I'm thinking your doormodel might not be loaded in by the time you define it up there:

local doorModel = game.Workspace.Barriers

So you should do this:

local doorModel = workspace:WaitForChild("Barriers")

if not doorModel then
  warn("Door Model not found!")
  return
end

Also, it looks like you are doing all this on the client, since you are getting the local player. That means any exploiter can easily just let themselves in, since all of this code is running on their machine.

You should check this on the server instead