Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Button being pressed doesnt change the text in a text box?

Asked by 3 years ago

whats meant to be happening is when you click on a button its meant to change the text in a text box. When ever i press the button i get an error saying "Attempt to index string with 'Text'"

local button = script.Parent
local name = script.Parent.Parent.Parent.Parent.Abilities.Frame.Name
local description = script.Parent.Parent.Parent.Parent.Abilities.Frame.Description
local req = script.Parent.Parent.Parent.Parent.Abilities.Frame.Requirements

function leftClick()
    name.Text = "FireBall"
    description.Text = "Shoot out a small ball of fire from your palm"
    req.Text = "Level - 1"
end

button.MouseButton1Click:Connect(leftClick)

1 answer

Log in to vote
1
Answered by
Robowon1 323 Moderation Voter
3 years ago
Edited 3 years ago
local name = script.Parent.Parent.Parent.Parent.Abilities.Frame.Name

---------------------------------------------------------------------------------------^^^

Change the name of the textbox to something other than 'Name' otherwise you're interfering with the property that already exists called Name.

0
still getting the same error DraconianSG 58 — 3y
0
Nvm i got it DraconianSG 58 — 3y
Ad

Answer this question