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.
COMMUNITY QUESTION
How do I print a variable on to a textBox?
4 answers
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!
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")
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.
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.
