park8
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 13 |
|
|
| 15 Jul 2015 09:50 PM |
This is my first time posting to the forum, lol
Anyways I'm not MUCH of a scripter, but I understand most of the basics of what it's about.
Right now I'm trying to make a GUI change text, depending on whether or not a Boolvalue is true or false
I made a GUI and placed it in starter GUI and inserted a BoolValue called "Playing" into the workspace. I've rigged the main game script to change this value to true, when the game is in session and back to false, when the game is not (At least I think anyways...)
Anyways, I've placed this into the Starter GUI under the text box
---
gui = script.Parent while true do if game.Workspace.Playing.Value == true then gui.Text.Value = "" print("Game Currently Active") else gui.Text.Value = "Please wait for the next game to be chosen..." end end
---
I've tested this out with the Output opened, but receive no errors regarding the script...
Can anyone tell me what I'm doing wrong? And if it's not too much to ask I'd also like to know how to create a script that changes the texts of a players GUI inside game.Players.PlayerGui
I'm assuming it involves something like :FindFirstChild, but again I'm unsure of how to use it
Thanks - park8,parky |
|
|
| Report Abuse |
|
|
park8
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 13 |
|
|
| 15 Jul 2015 09:52 PM |
I've found out what was wrong, but it still didn't fix it....this is the script after FINAL revision...
----
gui = script.Parent.Parent.Name while true do if game.Workspace.Playing.Value == true then gui.Text = "A game is currently in session..." print("Game Currently Active") else gui.Text = "Please wait for the next game to be chosen..." print("Waiting for game...") end
---- |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 15 Jul 2015 10:50 PM |
The reason for it not working is because you're changing the Name's Text Value, which I don't think exists. Also use .Changed, it is more efficient in this case than a loop.
gui = script.Parent.Parent game.Workspace.Playing.Changed:connect(function() if game.Workspace.Playing.Value == true then gui.Text = "A game is currently in session..." print("Game Currently Active") else gui.Text = "Please wait for the next game to be chosen..." print("Waiting for game...") end end) |
|
|
| Report Abuse |
|
|
park8
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 13 |
|
|
| 16 Jul 2015 02:45 AM |
Heya, thanks for the quick respond
I finally got the script to work, however The text would only change after the value changed AND the player reset, so it wouldn't change when people are playing
This is the partly working script that I used
--
if game.Workspace.Playing.Value == true then script.Parent.Text = "A game is currently in session..." print("Game Currently Active") else script.Parent.Text = "Please wait for the next game to be chosen..." print("Waiting for game...") end
--
Assuming from the code I copied from you, it was supposed to change on a value change from the "game.Workspace.Playing.Changed:connect(function()"
However after running the server it wouldn't change at all, is there something I'm missing? I'm still kinda nooby about functions and anything beyond it |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2015 02:52 AM |
| The value needs to change after the change coruscation. |
|
|
| Report Abuse |
|
|