Fix "X Is Not a Valid Member of Y" Errors in Roblox Studio
What the Roblox "is not a valid member of" error means, how to read it, and fixes for typos, timing, streaming, ServerStorage, and PlayerGui causes.
On this page
- How to read the “is not a valid member of” error
- Cause 1: The name doesn’t match exactly
- Cause 2: The property belongs to a different object
- Cause 3: The object hasn’t replicated to the client yet
- Cause 4: The part hasn’t streamed in (StreamingEnabled)
- Cause 5: You’re looking in ServerStorage or ServerScriptService from the client
- Cause 6: Your GUI lives in StarterGui, not PlayerGui
- Cause 7: leaderstats or another script-made object isn’t there yet
- Which fix should you use?
- If it still doesn’t work
- Related guides
- Sources
The Roblox error “X is not a valid member of Y” means your script used a dot to reach something the object doesn’t have, at least not at the moment that line ran. It’s one of the most common errors in Roblox Studio, and it almost always comes down to a name mismatch, timing, or the client and server seeing different things.
How to read the “is not a valid member of” error
The message in the Output window has three parts. Here is a typical example:
Door is not a valid member of Model "Workspace.House"
- Door is the child or property your code asked for.
- Model is the class of the object you indexed.
- “Workspace.House” is the full path to that object.
So this line means: “I looked inside the Model at Workspace.House and found nothing called Door.” Click the error in Output to jump to the line, then compare that path with what you see in the Explorer.
This is different from the “attempt to index nil” error. There, the object on the left of the dot doesn’t exist at all. Here, the object exists, but the thing you asked for inside it doesn’t. If you’re getting the nil version, see how to fix “attempt to index nil with”.
Cause 1: The name doesn’t match exactly
Luau names are case-sensitive, so hitbox and Hitbox are two different names. Extra spaces, a stray character, or an object someone renamed will all cause this error.
- Select the object in the Explorer.
- Check its Name in the Properties window, character by character.
- Copy that name into your script instead of retyping it.
The Creator Hub also notes a rule about the dot operator: a name can only be used after a dot if it starts with a letter or underscore and contains only letters, numbers, and underscores. A name with a space or a symbol, like Red Door, has to be reached another way:
local house = workspace.House
local door = house["Red Door"] -- brackets work with any name
local sameDoor = house:FindFirstChild("Red Door") -- returns nil if missing
The bracket form behaves like the dot, so it still errors if the child is missing. FindFirstChild returns nil instead of erroring, which lets you check for it.
Cause 2: The property belongs to a different object
The same error appears when you ask an object for a property it simply doesn’t have. A classic example is player.Health. Health is a property of the character’s Humanoid, not the Player, so you get “Health is not a valid member of Player”.
Look at the class named in the error, then check that class’s page on the Creator Hub API reference to see whether the property exists there. For health, go through the character:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
print(player.Name, "has", humanoid.Health, "health")
end)
end)
CharacterAdded fires each time the character spawns, and WaitForChild("Humanoid") waits until the Humanoid is inside the new model before the script reads Health.
Cause 3: The object hasn’t replicated to the client yet
This is the cause when the name is correct and the object is clearly in Explorer, but a LocalScript still errors. The Creator Hub’s WaitForChild documentation explains that Roblox doesn’t guarantee when, or in what order, objects replicate from the server to the client. When a LocalScript starts, some objects may not have arrived yet.
The fix is to wait for them:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remotes = ReplicatedStorage:WaitForChild("Remotes")
local buyEvent = remotes:WaitForChild("BuyItem")
WaitForChild returns the child right away if it already exists. If not, it pauses the script until the child appears. You can pass a second argument, a timeout in seconds, after which it gives up and returns nil.
Cause 4: The part hasn’t streamed in (StreamingEnabled)
When Workspace.StreamingEnabled is on, the client only receives parts near the player’s character. A LocalScript that does workspace.Map.FarTower can fail because FarTower simply hasn’t been sent to that client yet.
- Use
WaitForChildon the model you need, as Roblox suggests for atomic models. - Write client code that tolerates parts streaming in and out, rather than assuming everything in Workspace is always present.
- For logic that must always see a part (like a door that opens for everyone), consider running it in a server Script instead, where the whole Workspace is available.
Cause 5: You’re looking in ServerStorage or ServerScriptService from the client
Roblox’s documentation is clear: objects inside ServerStorage don’t replicate to the client and can’t be reached from LocalScripts. ServerScriptService is meant for server-only code. So a LocalScript asking for game.ServerStorage.Sword will fail even though the sword is right there in Studio’s Explorer.
| Container | Server scripts can see it | LocalScripts can see it |
|---|---|---|
| ReplicatedStorage | Yes | Yes |
| Workspace | Yes | Yes (subject to streaming) |
| ServerStorage | Yes | No |
| ServerScriptService | Yes | No |
Move anything both sides need, such as RemoteEvents or shared ModuleScripts, into ReplicatedStorage. Keep server-only assets in ServerStorage and hand them to the client only through a server script.
Cause 6: Your GUI lives in StarterGui, not PlayerGui
Scripts often error with something like “MainMenu is not a valid member of StarterGui” or fail to find a screen in PlayerGui. The Creator Hub explains how this works: when a player’s character spawns, StarterGui’s children are copied into that player’s PlayerGui. Players see the copy, not the original.
So a script should look in PlayerGui, and wait for it, as in this LocalScript:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui")
local menu = gui:WaitForChild("MainMenu")
menu.Enabled = true
Also note that a ScreenGui with ResetOnSpawn turned on is emptied and re-copied every time the character respawns, so a reference you saved earlier can point to an old copy. If the GUI should persist across respawns, set ResetOnSpawn to false on that ScreenGui.
Cause 7: leaderstats or another script-made object isn’t there yet
Some objects don’t exist in Studio at all because a script creates them at runtime. The usual example is leaderstats, which the Creator Hub’s leaderboard guide creates inside each player from a PlayerAdded handler. If another script runs first, player.leaderstats errors.
- Use
player:WaitForChild("leaderstats")in scripts that read it. - Make sure the folder is named
leaderstatsin all lowercase, which Roblox requires for it to show on the leaderboard.
Which fix should you use?
flowchart TD
A["Error: X is not a valid member of Y"] --> B{"Name matches Explorer exactly?"}
B -->|"No"| C["Fix the name or use brackets"]
B -->|"Yes"| D{"Running in a LocalScript?"}
D -->|"Yes"| E["Use WaitForChild or ReplicatedStorage"]
D -->|"No"| F{"Could the object be missing?"}
F -->|"Yes"| G["Use FindFirstChild and check nil"]
F -->|"No"| H["Check the property's class"]
As a rule of thumb: use WaitForChild for things that will show up soon, use FindFirstChild for things that might not exist, and use the plain dot only for things you know are already there. The Creator Hub notes that FindFirstChild is a bit slower than the dot, so store the result in a variable instead of calling it inside a tight loop.
If it still doesn’t work
- Press Play and, while the game runs, look at the Explorer. Switch between the client and server views while testing to see what each side actually has.
- Add
print(parent:GetChildren())just before the failing line to list what really is inside the object at that moment. - Check that no other script renames, moves, or destroys the object before your line runs.
- Test any fix in Studio first, both in Play and with a local server, because timing on a live server can differ.
If your error shows up while loading animations instead, the guide to fixing “Failed to Load Animation” covers that separate case.
Related guides
- Fix “Infinite Yield Possible” WaitForChild Warning in Roblox
- Fix “Attempt to Index Nil With” Errors in Roblox Studio
- Fix DataStore Error 104 “Cannot Store” in Roblox Studio
- Fix “Attempt to Perform Arithmetic on Nil” in Roblox Luau
Sources
- Instance class reference (Name, FindFirstChild, WaitForChild) – Roblox Creator Hub
- ServerStorage class reference – Roblox Creator Hub
- StarterGui class reference – Roblox Creator Hub
- Player class reference (Character, CharacterAdded) – Roblox Creator Hub
- Script locations and RunContext – Roblox Creator Hub
- Instance streaming – Roblox Creator Hub
- Leaderboards (leaderstats) – Roblox Creator Hub
- “Isn’t a valid member” but it is? – Roblox Developer Forum
Frequently asked questions
What does "is not a valid member of" mean in Roblox?
Your script used a dot to reach a child or property that the object doesn't have at that moment. The first name in the message is what you asked for, and the second part tells you which object you asked.
Why does it say not a valid member when I can see the object in Explorer?
Usually the name doesn't match exactly (capital letters and spaces count), the object hasn't replicated or streamed in yet when the script runs, or you are looking at the server view while a LocalScript runs on the client.
Should I use WaitForChild or FindFirstChild to fix it?
Use WaitForChild when the object will exist soon, such as things replicated from the server or GUIs copied into PlayerGui. Use FindFirstChild when the object may not exist at all, and check the result for nil before using it.
Why can't my LocalScript find something in ServerStorage?
Roblox documents that ServerStorage contents never replicate to the client and are not accessible from LocalScripts. Move shared objects to ReplicatedStorage instead.