In short
A dot only works on objects and tables. This error says the value before the dot was a number (or a boolean, in the boolean version), so it has no .Value, .Name or any other field. Most often you already read .Value once and then tried to read it again, or the two loop variables of ipairs are the wrong way round.
What the message means
ServerScriptService.CoinPad:7: attempt to index number with 'Value'
Other forms of the same message:
attempt to index boolean with 'Parent'attempt to index number with 'Transparency'
Numbers and booleans are plain values. They have no children and no properties, so 5.Value or true.Parent has nothing to read. Luau names the type it found (number, boolean) and the key you asked for.
Strings behave differently: reading an unknown name from a string gives nil without an error, so a mistake with a string shows up one step later as attempt to index nil or attempt to call a nil value.
Causes and fixes
Three things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.
- You read .Value, then used it like the object
- The ipairs variables are the wrong way round
- A true or false went where an object should be
You read .Value, then used it like the object
coins.Value is a number. If you save it in a variable and later write coins.Value again on that number, you get attempt to index number with 'Value'. Saving the number also means changing the variable never changes the real stat.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
local coins = leaderstats:WaitForChild("Coins").Value -- a number
-- attempt to index number with 'Value'
coins.Value += 10
end)
Keep the object (the IntValue) in the variable, and read or change .Value on it when you need it.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player: Player)
local leaderstats = player:WaitForChild("leaderstats", 10)
local coins = leaderstats and leaderstats:WaitForChild("Coins", 10)
if coins and coins:IsA("IntValue") then
coins.Value += 10 -- changes the stat itself
end
end)
The ipairs variables are the wrong way round
ipairs gives the position first and the value second. Writing for part, i in ipairs(list) makes part the number 1, 2, 3, and the first dot on it fails.
local folder = workspace:WaitForChild("Lights")
for light, i in ipairs(folder:GetChildren()) do
-- light is the index (a number): attempt to index number with 'Transparency'
light.Transparency = 0.5
end
Put the index first. Use _ when you do not need it, and check the class before setting a property only some objects have.
local folder = workspace:WaitForChild("Lights")
for _, light in ipairs(folder:GetChildren()) do
if light:IsA("BasePart") then
light.Transparency = 0.5
end
end
A true or false went where an object should be
Functions like IsA, IsDescendantOf and comparisons return true or false, not the object. Using that result with a dot gives attempt to index boolean with. The same happens with x == y and x style shortcuts written the wrong way round.
local part = script.Parent
part.Touched:Connect(function(hit)
local isCharacterPart = hit.Parent:FindFirstChild("Humanoid") ~= nil
-- a boolean: attempt to index boolean with 'Parent'
print(isCharacterPart.Parent.Name)
end)
Keep the object and the check in separate variables: the object to use, the boolean only in the if.
local part = script.Parent :: BasePart
part.Touched:Connect(function(hit: BasePart)
local character = hit:FindFirstAncestorOfClass("Model")
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
if character and humanoid then
print(character.Name)
end
end)
Fix it in your place
Paste the error, RoCode fixes it in your place
Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.
RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.
How to find the line that causes it
- Open Output (Window menu, or the Script tab), clear it with Ctrl+K (⌘K on Mac), and press Play.
- Find the first red line. It starts with the script's place in the Explorer and the line number, such as
ServerScriptService.Shop:12:. - Click the red line. Studio opens that script with the cursor on the failing line.
- Read the lines between
Stack BeginandStack Endunder it: they list the calls that led there, newest first, so you can see which function called the broken one. - Still not sure which value is wrong? Add
print(typeof(x), x)just above the line, or set a breakpoint on it and read the values in the Watch window.
Questions
What does attempt to index number with 'Value' mean?
You wrote .Value on something that is already a number, almost always because you saved stat.Value in a variable earlier. Save the IntValue or NumberValue object instead and use .Value on it.
Why does changing my saved number not change the leaderboard?
A number is copied when you put it in a variable. Changing the copy does nothing to the IntValue. Keep a reference to the object and set object.Value.
What about attempt to index boolean with 'X'?
Same idea with true or false: a check such as IsA or ~= returned a boolean, and the code then used it like an object. Use the object you checked, not the result of the check.
Can RoCode fix it?
Yes. Paste the Output line into RoCode. It reads the script in your open place and changes the variable to hold the object, or fixes the loop, where the error happens.
Sources and further reading
- Roblox Creator Docs: IntValue
- Roblox Creator Docs: ipairs. returns the index, then the value
- Luau: syntax
How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 23 October 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked by running the broken code with the Luau command line tool and against the message strings in Roblox Studio itself on 23 October 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.