01 | for i,v in pairs (game.Players:GetPlayers()) do |
02 | Chillers = script.Parent.Chillers.Value |
03 | people = script.Parent.People.Value |
04 | Workers = script.Parent.Workers.Value |
05 | MyWorkers = script.Parent.MyWorkers.Value |
06 | people.Value = Chillers.Value+Workers.Value+MyWorkers.Value |
07 | v.PlayerGui.ScreenGui.Chillers.Text = ( "Unemployed: " ..Chillers.Value) |
08 | v.PlayerGui.ScreenGui.Workers.Text = ( "Working: " ..Workers.Value) |
09 | v.PlayerGui.ScreenGui.People.Text = ( "Total People: " ..people.Value) |
10 | v.PlayerGui.ScreenGui.MyWorkers.Text = ( "Your Workers: " ..MyWorkers.Value) |
11 | end |
This is in a local script and the value is on default set onto 1 so correctly the code says "unemployed: 1" but when I change the value my self. (I manually go into the properties of the value and change the number without scripts.) The gui text remains as "unemploued: 1" Can I have help for this problem.
Unless this in a player or one of their descendants (PlayerGui, ect.) try using a server script and put it in the ServerScriptService. The problem is that this only runs once the game starts, here would be a solution:
01 | function updategui() |
02 | for i,v in pairs (game.Players:GetPlayers()) do |
03 | Chillers = script.Parent.Chillers.Value |
04 | people = script.Parent.People.Value |
05 | Workers = script.Parent.Workers.Value |
06 | MyWorkers = script.Parent.MyWorkers.Value |
07 | people.Value = Chillers.Value+Workers.Value+MyWorkers.Value |
08 | v.PlayerGui.ScreenGui.Chillers.Text = ( "Unemployed: " ..Chillers.Value) |
09 | v.PlayerGui.ScreenGui.Workers.Text = ( "Working: " ..Workers.Value) |
10 | v.PlayerGui.ScreenGui.People.Text = ( "Total People: " ..people.Value) |
11 | v.PlayerGui.ScreenGui.MyWorkers.Text = ( "Your Workers: " ..MyWorkers.Value) |
12 | end |
13 | end |
14 |
15 | -- The following call the function updategui() whenever one of them is changed |
16 | script.Parent.People.Changed:connect(updategui) |
17 | script.Parent.Workers.Changed:connect(updategui) |
18 | script.Parent.Chillers.Changed:connect(updategui) |
Hope this helped.