Rank Dorr Script Not Working

Hey, there! I have a rank door script, but it’s not working. When I check the console in-game, it says the door is not a valid member of ‘Workspace’. The Door is in workspace though. Can anyone find the problem?

Script

local Player = game.Players.LocalPlayer
local doorPart = game.Workspace.Door.Door1
local groupId = 12844977 --Change this with your group id
local minimumRank = 40

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

Console:

local doorPart = game.Workspace.Door.Door1

You’ve likely got the reference incorrect. Can you show a screenshot of the explorer window?

image

Okay, that’s correct, try this:

local Player = game.Players.LocalPlayer
local door = game.Workspace:WaitForChild("Door")
local doorPart = door:WaitForChild("Door1")
local groupId = 12844977 --Change this with your group id
local minimumRank = 40

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

Thanks so much, it’s working now!