Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Player and Player Gui?


	
	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.

2 comments

0

Is FE on?

0

whats fe

2 answers

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

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.