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

When i enter a somthing in a textbox it should print it but it just prints nothing why??

Asked by 5 years ago

For example, I enter something and I made a variable called plrname and I try to print it is printed but the print is empty when I have entered text inside it why is that??

(for now, I'm just printing when you enter something to test it)

wait(1)
local status = script.Parent.Parent.status
local fire = game.ReplicatedStorage.Admin.Fireplr
local button = script.Parent
local remote = game.ReplicatedStorage.Admin.Fireplr
local plrname = script.Parent.Parent.PlrName.Text
button.MouseButton1Click:Connect(function()
    wait(1)
        print(plrname)
end)

Thank in advance!

1 answer

Log in to vote
2
Answered by
JakyeRU 637 Moderation Voter
5 years ago

Hello.

You defined plrname outside of the event. So it will not update when you update the text.

Put plrname inside the event. Like this:

button.MouseButton1Click:Connect(function()
    local plrname = script.Parent.Parent.PlrName.Text
    print(plrname)
end)
0
More accurately, he should define `plrname` to be the PlrName instance, and then print `plrname.Text` which will update User#6546 35 — 5y
0
Thank You! Freddan2006YT 88 — 5y
Ad

Answer this question