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

What does this Lua error mean!?

Asked by 9 years ago
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

Log in to vote
0
Answered by 9 years ago

: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!

0
Hmm, well can I PM the whole script? It runs every time a player enters or leaves the game Leg0brick 10 — 9y
0
leaves? TheStudentPilot 75 — 9y
Ad

Answer this question