attempt to index boolean with 'Value'in Roblox Luau: what it means and how to fix it
What it means
You used a dot on true or false. The most common reason is pcall: its first result is a boolean that says whether the call worked, and the data comes second.
The smallest script that triggers it
local data = pcall(function()
return store:GetAsync(key)
end)
print(data.Value)
The fix
local ok, data = pcall(function()
return store:GetAsync(key)
end)
if ok and data then
print(data.Value)
end
pcall returns two values. Catching both puts the success flag in ok and the real result in data.
Common causes
- Only the first result of pcall was kept, which is the success flag.
- A variable was set from a comparison such as `x == y` and later used as a table.
- A function returns true or false in some branches and a table in others.
Practice this until it sticks
A Deep Dive on pcall and error handling: 5-minute lessons, each with a quiz. What you miss comes back in the next module. One Deep Dive a day is free. No card.