Unable to assign property Text. string expected, got Instancein Roblox Luau: what it means and how to fix it
What it means
You set a property to a value of the wrong type. The message names the property, the type it accepts and the type you gave it.
The same error also shows up as:
- Unable to assign property Position. Vector3 expected, got CFrame
- Unable to assign property Value. string expected, got nil
The smallest script that triggers it
local label = script.Parent
local coins = Instance.new("IntValue")
label.Text = coins
The fix
local label = script.Parent
local coins = Instance.new("IntValue")
label.Text = tostring(coins.Value)
coins is an object (an Instance). The number is in its Value, and tostring turns that number into the string Text accepts.
Common causes
- An object was assigned where its value was meant, for example an IntValue in place of its .Value.
- The value is the wrong type, for example a CFrame given to Position, which needs a Vector3.
- The value being assigned is nil because it was never set.
Practice this until it sticks
A Deep Dive on properties and data types: 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.