Leaderstat door not working

I am trying to make a door where a player has to have a certain level to walk through the door.

This script is a LocalScript located inside of the part.

local levelRequirement = 100
local player = game:GetService("Players").LocalPlayer

if player.Leaderstats.Level.Value >= levelRequirement then
	script.Parent.CanCollide = false

I don’t think LocalScripts run if they are a descendant of game.Workspace

Put the script in StarterPlayerScripts if thats the case

1 Like

I’m pretty sure leaderstats has to be lowercase.


Even after making it lowercase the door still isn’t working

1 Like

LocalScripts don’t work in Workspace.

Also, in your script, you’re checking if the player has the required level only once. So, if the player joined as level fifty-seven, then advanced to level one hundred, the script wouldn’t detect that and the door would not change for that player.

You should add event-based checking. So, when the player’s Level changes, check if the new value hit the requirement then, too.


If it matters to you, you should check on the server if the player has the required level to be past that door, too.
For example, let’s say the door is to a room, and the player is in the room; you should check on the server if the player’s Level is high enough for that player to be in that room, and if not, teleport them out of it.

Server-sided checking will prevent exploiters from having the access to that area if their Level objects do not meet the requirement according to the server’s knowledge (data), since the exploiters can easily change their Level objects’ properties locally.


Depending on how many doors you want to be level locked, a script for each door is not the right way but for one door. Try this, it should work aslong as you put the right location to the door.

local plr = game.Players.LocalPlayer

local leaderstats = plr:WaitForChild("leaderstats")

local plrLevel = leaderstats:WaitForChild("Level")

local door = game.Workspace:WaitForChild("PUTDOORHERE") -- put the door's location here

local levelRequirement = 100

function try()
	if plrLevel.Value >= levelRequirement then
		door.CanCollide = false



This LocalScript goes in StarterPlayerScripts


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.