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


for i,v in pairs(game.Players:GetPlayers()) do local Chillers =script.Parent.Chillers.Value local people = script.Parent.People.Value local Workers =script.Parent.Workers.Value local MyWorkers =script.Parent.MyWorkers.Value people.Value=Chillers.Value+Workers.Value+MyWorkers.Value v.PlayerGui.ScreenGui.Chillers.Text=("Unemployed: "..Chillers.Value) v.PlayerGui.ScreenGui.Workers.Text=("Working: "..Workers.Value) v.PlayerGui.ScreenGui.People.Text=("Total People: "..people.Value) v.PlayerGui.ScreenGui.MyWorkers.Text=("Your Workers: "..MyWorkers.Value) end

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

for i,v in pairs(game.Players:GetPlayers()) do
    local Chillers =script.Parent.Chillers.Value --Defines the variable, you now can't change the value.
    local people = script.Parent.People.Value --Defines the variable, you now can't change the value.
    local Workers =script.Parent.Workers.Value --Defines the variable, you now can't change the value.
    local MyWorkers =script.Parent.MyWorkers.Value --Defines the variable, you now can't change the value.
    people.Value=Chillers.Value+Workers.Value+MyWorkers.Value --Trying to index a value of a value.
        v.PlayerGui.ScreenGui.Chillers.Text=("Unemployed: "..Chillers.Value)
    v.PlayerGui.ScreenGui.Workers.Text=("Working: "..Workers.Value)
    v.PlayerGui.ScreenGui.People.Text=("Total People: "..people.Value)
    v.PlayerGui.ScreenGui.MyWorkers.Text=("Your Workers: "..MyWorkers.Value)
end

How to fix it~

for i,v in pairs(game.Players:GetPlayers()) do
    local Chillers =script.Parent.Chillers
    local people = script.Parent.People
    local Workers =script.Parent.Workers
    local MyWorkers =script.Parent.MyWorkersvalue.
    people.Value=Chillers.Value+Workers.Value+MyWorkers.Value 
    v.PlayerGui.ScreenGui.Chillers.Text=("Unemployed: "..Chillers.Value)
    v.PlayerGui.ScreenGui.Workers.Text=("Working: "..Workers.Value)
    v.PlayerGui.ScreenGui.People.Text=("Total People: "..people.Value)
    v.PlayerGui.ScreenGui.MyWorkers.Text=("Your Workers: "..MyWorkers.Value)
end

~ should fix it.


Hope I helped solve your problem!

Answer this question