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

ScreenGui is not a member of PlayerGui??

Asked by
bossay6 62
7 years ago

This error came from two scripts.

1st Script:

wait(1)
while game.ServerScriptService.Playing.AlivePlayers.Value > 0 do        
    local list = workspace.Map.CS:GetChildren()
    m = list[math.random(#list)]
    for i, v in pairs(game.Players:GetChildren())do
        v.PlayerGui.ScreenGui.ColorFrame.Frame.BackgroundColor3 = m.Color
        v.PlayerGui.ScreenGui.ColorFrame.ColorName.Text = m.BrickColor.Name
    end
    wait(7)
    for i, v in pairs(workspace.Map.CS:GetChildren())do
        if v.BrickColor.Name ~= m.BrickColor.Name then
    v.CanCollide = false
    v.Transparency = 0.7
end
    end 
    wait(3)
    for i, v in pairs(workspace.Map.CS:GetChildren())do
    v.CanCollide = true
    v.Transparency = 0
        v.BrickColor = BrickColor.Random()
    end
end
repeat wait(1) until game.ServerScriptService.Playing.AlivePlayers.Value <= 0
game.ServerScriptService.Main.Disabled = true
    for i, v in pairs(game.Players:GetChildren())do
        v.PlayerGui.ScreenGui.ColorFrame.Visible = false
        v.PlayerGui.ScreenGui.TextLabel.Visible = true
        game.ReplicatedStorage.Text.Value = "Nobody Survived!"
    end
    wait(5)
    workspace.Map:ClearAllChildren()
    game.ServerScriptService.Main.Disabled = false
    script.Disabled = true

2nd Script:

local text = game.ReplicatedStorage.Text

while true do
    for i = 25, 0, -1 do
        text.Value = "Next Round in "..i
        wait(1)
    end
    wait(2)
        text.Value = "Picking Gamemode..."  
        wait(5)
        local gamemode = math.random(1)
        if gamemode == 1 then
            game.Lighting.CS:Clone().Parent = workspace.Map
            for i, v in pairs(workspace.Map.CS:GetChildren())do
                if v:IsA("BasePart") then
                v.BrickColor = BrickColor.Random()
                end
            end
            text.Value = "The gamemode will be Color Scramble!"
            wait(3)
            game.ServerScriptService.Playing.AlivePlayers.Value = game.Players.NumPlayers
            for i, v in pairs(game.Players:GetChildren())do
                local list = workspace.Spawns:GetChildren()
                m = list[math.random(#list)]
                v.Character.HumanoidRootPart.CFrame = CFrame.new(m.Position) + Vector3.new(0,5,0)
            end
            wait(2)
            game.ServerScriptService.CSScript.Disabled = false
            for i, v in pairs(game.Players:GetChildren())do
                v.PlayerGui.ScreenGui.TextLabel.Visible = false
                v.PlayerGui.ScreenGui.ColorFrame.Visible = true
            end
            wait(121)
        end
        game.ServerScriptService.CSScript.Disabled = true
            for i, v in pairs(game.Players:GetChildren())do
                v.PlayerGui.ScreenGui.TextLabel.Visible = true
                v.PlayerGui.ScreenGui.ColorFrame.Visible = false
            end
            if game.ServerScriptService.Playing.AlivePlayers.Value > 1 then
                 text.Value = "Multiple people have won!"
            elseif game.ServerScriptService.Playing.AlivePlayers.Value == 1 then
                 text.Value = "One person has won!"
            end
            wait(5)
        game.ServerScriptService.Playing.AlivePlayers.Value = 0
        workspace.Map:ClearAllChildren()
end

is not working in the real game

Error: ScreenGui is not a valid member of PlayerGui

all of these scripts are in a regular script in ServerScriptService.

0
and please dont tell me to indent, i would have to redo the scripts, and this took me 2 days bossay6 62 — 7y
0
:WaitForChild() creeperhunter76 554 — 7y
0
wait for child gives me a "yeild" error or something like that bossay6 62 — 7y
0
Indent? There's an auto indent feature on ROBLOX studio which is automatically on, and it takes more time to delete those indents. I suggest you take a look in my bio. hiimgoodpack 2009 — 7y
View all comments (2 more)
0
nah, im dont using it. i just need this dang script working. there is no indenting errors bossay6 62 — 7y
0
Indenting are just whitespaces when the code is being ran, but indenting makes it neater. hiimgoodpack 2009 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

I'm pretty sure you need to locate the object in the PlayerGui first.

Revised 1st Script lines 5-8

for i, v in pairs(game.Players:GetChildren())do
local gui= v.PlayerGui:FindFirstChild("ScreenGui")
    gui.ColorFrame.Visible = false
    gui.TextLabel.Visible = true
    game.ReplicatedStorage.Text.Value = "Nobody Survived!"
    end

Revised 2nd Script lines 29-32

for i, v in pairs(game.Players:GetChildren())do
local gui = v.PlayerGui:FindFirstChild("ScreenGui")
    gui.TextLabel.Visible = false
    gui.ColorFrame.Visible = true
end

If this doesn't solve your problem, please be more specific in the question you are asking like the error messages coming from it. If it's saying its nil or something.

Also if this doesn't work, make sure you name things in the StarterGui different things if there is more than one ScreenGui.

0
none of these worked. bossay6 62 — 7y
0
dude a computer is perfectly capable of showing a UI hiimgoodpack 2009 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Think about it. Your browser shows you the images and text and this answer on your computer, not here. The server cannot do that, since your computer's display is on YOUR computer. So, handle UI work on your computer!

0
what? bossay6 62 — 7y
0
this isn't helping me, i do not work with websites, i work with roblox bossay6 62 — 7y
0
ROBLOX is like websites. Your computer still has your display you are looking at. hiimgoodpack 2009 — 7y
0
dude cant you clearly see the problem? the gui isn't showing, i dont need this website stuff bossay6 62 — 7y
View all comments (4 more)
0
Yes you do since you clearly don't understand what is in your computer and what is not. hiimgoodpack 2009 — 7y
0
You need to at least think about what I am saying so you can learn from your mistakes. hiimgoodpack 2009 — 7y
0
HOW DO I THINK ABOUT IT IF IM CONFUSED OUT IT bossay6 62 — 7y
0
Make a pastebin and show me the answers for the quiz i made right here https://pastebin.com/UZZsV8xZ hiimgoodpack 2009 — 7y

Answer this question