So I was working on my clicker game when I ran into an error saying, "attempt to index string with 'Text' and here is the code
local moreRebirthButton = script.Parent local infoHolder = moreRebirthButton.Parent.Parent.info local price = infoHolder.Frame.TextLabel local upgradeInfo = infoHolder.info local upgradeName = infoHolder.Name local Players = game:GetService("Players") local player = Players.LocalPlayer local upgradesFile = player:WaitForChild("upgrades") moreRebirthButton.MouseButton1Up:Connect(function() local rebirthsButtonData = upgradesFile:WaitForChild("rebirthButtons") upgradeInfo.Text = "This will give you a boost!" upgradeName.Text = "Rebirth Buttons" price.Text = ((10)+(rebirthsButtonData.Value*10)).."Gems" if infoHolder.Visible == false then infoHolder.Visible = true end rebirthsButtonData.Changed:Connect(function() price.Text = ((10)+(rebirthsButtonData.Value*10)).."Gems" end) end)~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~ Help will be great
Next time put the full error to save us having to find the line. On line 6 you defined upgradeName to be infoHolder.Name. Name
is a property of all instances, so doing .Name
will return a string (its name). Even if you have a TextLabel or some other instance in there named "Name", doing .Name
will always return the property. So with that being said, on line 15 you are attempting to set "Text" of a string. So in total, you are trying to doinfoHolder.Name.Text
, which of course doesn't work. Make sure the variable on line 6 is set properly.