This script should automatically and infinitely check an int value's value and insert it into my text in my textbutton.
local button = script.Parent.TextButton local text = button.Text while wait() do local num = game.Workspace:WaitForChild("NumParts").Value text.Value = ("Click to Place Parts! "..num.."/3 Parts.") end
I keep on getting the error attempt to index local 'text' (a string value)
and I don't know what to do about it.
EDIT: This is in a normal script
The Text property doesn't have a child named Value. The text is the actual string, meaning you can get rid of that .Value at the end there and it should fix it.
In the second line, you have already said .Text
which is already a string value.
I would also recommend using GetPropertyChangedSignal. loops
can cause lag to your game.
local Button = script.Parent.TextButton local Text = Button.Text -- As you see right here, you have already said .Text which is the string value. while wait() do local num = game.Workspace:WaitForChild("NumParts").Value Text = ("Click to Place Parts! "..num.."/3 Parts.") -- We got rid of the .Value here since we already defined it on the Text variable. end