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

How do I print a variable on to a textBox?

Asked by 9 years ago

I want to tell the players when another player has died via textBox. But I dont know how to post the variable of Death onto the box.

4 answers

Log in to vote
0
Answered by 9 years ago

You could use Global variables.

Say you have a screengui inside every players gui, and a textlabel inside of that. We name the gui Died, and name the label pickle. Then we put a script into StarterGui and put inside:

while wait() do
if script.Parent.Parent.Character.Humanoid.Health==0 then
_G.Died=script.Parent.Parent.Name.." has died!"
wait(5)
_G.Died=""
end
end

and then, inside a script inside Pickle we put,

while wait() do
script.Parent.Text=_G.Died
end

That simple! Hope this helped!

Ad
Log in to vote
0
Answered by
P100D 590 Moderation Voter
9 years ago

Set the name of the player to a variable, and then use the following:

local textbox = <text box>
local ded = <dead player>

textbox.Text = (ded.Name .. " died. RIP")
Log in to vote
0
Answered by
lucas4114 607 Moderation Voter
9 years ago

So if you had a text box GUI then you could do something like this:

Textbox = blahblahblah -- put the text box here...

Textbox.Text = "blah blah blah blah" -- heres where you put your variable.
Log in to vote
0
Answered by 9 years ago
Textbox = Hello World! --Text you want to input (Can be a bricks name or any type of data.)

Textbox.Text = (Textbox.."Goodbye World!")  -- Textbox is the variable that says Hello World!

Answer this question