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

My script is supposed to change the text on a textbox but it isn't, help?

Asked by 3 years ago
local text = game.Workspace.Sign.Sign.SurfaceGui.TextBox.Text
local debounce = true

script.Parent.Touched:Connect(function(hit)
    if debounce == true then
        debounce = false
        print("stepped on")
        text = "insert flash text"
        wait(2)
        text = "insert normal text"
        debounce = true
    end
end)

This is my code. It's not complicated and I didn't expect to get stuck here, but here I am. The output successfully prints "stepped on"

1 answer

Log in to vote
0
Answered by 3 years ago

If you write

local text = game.Workspace.Sign.Sign.SurfaceGui.TextBox.Text

your variable "text" would be equal to your TextBox Text, it will not refer to the TextBox text and in the line 08 you set the variable to "insert flash text" instead of change the object text

you need to put:

local text = game.Workspace.Sign.Sign.SurfaceGui.TextBox --text refers to your object
local debounce = true

script.Parent.Touched:Connect(function(hit)
    if debounce == true then
        debounce = false
        print("stepped on")
        text.Text = "insert flash text" --You change the object.Text
        wait(2)
        text.Text = "insert normal text" --Same here
        debounce = true
    end
end)

sorry for my english Hope you understand me

0
Bruh i was going to answer it :( LetalNightmare 99 — 3y
0
XD PepeElToro41 132 — 3y
Ad

Answer this question