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

What will make this text button change texts?

Asked by 6 years ago

I need it so that when the player clicks the text button, the text of it goes from "High", to "Low" and this script isn't working. There is a blue line under the word "Low". I am new to scripting and still learning so try to make it understandable for a newbie :D

script.Parent.MouseButton1Down:connect(function()
    script.Parent.Text = Low
end)
0
LocalScript DarkAssasin0 0 — 6y

1 answer

Log in to vote
5
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

The reason the text isn't changing is because you are giving it a variable to change to, you want to change it to a string

script.Parent.MouseButton1Down:connect(function()
    script.Parent.Text = "Low"
end)

Strings are made using " " or ' '

You can create a variable with a string value then use it to change the text of the button

local text = "Low"
script.Parent.MouseButton1Down:connect(function()
    script.Parent.Text = text
end)
0
So I make the Value in the StringValue Low? Or change the name of the StringValue to Low? Im confused never use Strings before DarkAssasin0 0 — 6y
0
@DarkAssasin0 which ever makes you more comfortable, if its not always going to be "Low" then make a variable that you can change later DanzLua 2879 — 6y
Ad

Answer this question