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

What does this Lua error mean!?

game.Players:GetChildren().PlayerGui.NotificationGiver.NotificationBar.TextStrokeTransparency = 0

This line of code in the script is made to change the TextStrokeTransparency value of a ScreenGUI to 1, but (as you would expect because I am posting this in SH) it dosn't. In the Output it says: 15:54:48.345 - Workspace.enoughPlayersChanger:24: attempt to index field 'PlayerGui' (a nil value) 15:54:48.345 - Stack Begin 15:54:48.345 - Script 'Workspace.enoughPlayersChanger', Line 24 15:54:48.346 - Stack End 15:54:48.346 - Disconnected event because of exception

Thank you for reading -Leg0Brick (Yeah this is like my 3rd question today... Sorry.)

1 answer

:GetChildren() returns simply a read-only copy of the the children in there. In order to fulfill your task, you will wish to do a For Loop.

You should define the Players as local players = game.Players:GetChildren() then you need to start off the loop

for i,v in pairs(players) do
	-- your code here
end

In-case you are wondering what for i,v means... v is the object, you use that to get into the children of each player. I honestly have no clue what i does other than when I use it, it errors saying something about a number value or something. You cannot just do v either, it will do the same thing that i does in the example above.

Any questions? If so, please ask!

2 comments

0

Hmm, well can I PM the whole script? It runs every time a player enters or leaves the game

0

leaves?

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