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

Script returns "Screen is not a valid member of PlayerGui" error?

Asked by 6 years ago
Edited 6 years ago

So I have been working on a script that uses a gui as a timer for each round of a game.

The initial ScreenGui is placed in StarterGui, and is named "Screen", while the text label within the Gui is named "Counter".

local function count(Text)
    local Players = game.Players:GetPlayers()
    for i = 1, #Players do
        Players[i].PlayerGui.Screen.Counter.Text = Text
    end
end

The whole thing works like it's supposed to when I play it Solo in studio with no problems whatsoever. The gui writes out or shows what I want it to show, and everything is good. However when I play it on a client or a test it on a local server, whenever the function is called, for example, "count('Testing1234')", the script fails to work, and outputs an error that says, "Screen is not a valid member of PlayerGui".

I have been trying to fix this for a while, however I haven't got any solutions yet, plus I'm just starting to learn scripting.

1 answer

Log in to vote
0
Answered by 6 years ago

No errors when running the Local Server I did not notice. I just used a LocalScript, so the error is not received.

Ad

Answer this question