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

Player and Player Gui?

Asked by 8 years ago
01for i,v in pairs(game.Players:GetPlayers()) do
02    local Chillers =script.Parent.Chillers.Value
03    local people = script.Parent.People.Value
04    local Workers =script.Parent.Workers.Value
05    local 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)
11end

This is in a local script and it always says that player gui is not a valid member of players.

0
Is FE on? User#11440 120 — 8y
0
whats fe shabbs15 67 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Try using a server script, also, check to see if Filtering Enabled is enabled (this can be found under workspace properties).

Ad
Log in to vote
0
Answered by 8 years ago

I'm not too sure this is the case, but I see you're defining a local variable as a certain value, and then later on the script you try to get the value of a value.

Your script

01for i,v in pairs(game.Players:GetPlayers()) do
02    local Chillers =script.Parent.Chillers.Value --Defines the variable, you now can't change the value.
03    local people = script.Parent.People.Value --Defines the variable, you now can't change the value.
04    local Workers =script.Parent.Workers.Value --Defines the variable, you now can't change the value.
05    local MyWorkers =script.Parent.MyWorkers.Value --Defines the variable, you now can't change the value.
06    people.Value=Chillers.Value+Workers.Value+MyWorkers.Value --Trying to index a value of a 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)
11end

How to fix it~

01for i,v in pairs(game.Players:GetPlayers()) do
02    local Chillers =script.Parent.Chillers
03    local people = script.Parent.People
04    local Workers =script.Parent.Workers
05    local MyWorkers =script.Parent.MyWorkersvalue.
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)
11end

~ should fix it.


Hope I helped solve your problem!

Answer this question