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

Custom Disaster script?

Asked by 8 years ago

Why does the Gui not show up? To all the players in the game? When the disaster start. Can someone help me ? Only the gui part of the script doesn't work.

local A = "event1"
local Lighting = game.Lighting
local Choos = 0
local Players = game.Players:FindFirstChild("PlayerGui")

while true do
    Choos = math.random(8)
    wait(4)
    if Choos == 2 then
        a = script:findFirstChild("GuiA"):Clone()
        a.Parent = Players.PlayerGui
        wait (5)
        a = Players.PlayerGui:findFirstChild("GuiA"):Destroy()
        b = script:findFirstChild("GuiAA"):Clone()
        b.Parent = Players.PlayerGui
        game.Lighting:findFirstChild(A):clone().Parent = game.Workspace
        Lighting.Brightness = 0.001
        Lighting.OutdoorAmbient = Color3.new(255/255, 255/255, 255/255)
        Lighting.ShadowColor = Color3.new(255/255, 255/255, 255/255)
        Lighting.FogColor = Color3.new(255/255, 255/255, 255/255)
        Lighting.FogEnd = 150
        Lighting.FogStart = 0
        wait (10) --Back normal
        Lighting.Brightness = 1
        Lighting.OutdoorAmbient = Color3.new(127/255, 127/255, 127/255)
        Lighting.ShadowColor = Color3.new(178/255, 178/255, 183/255)
        Lighting.FogColor = Color3.new(75/255, 75/255, 75/255)
        Lighting.FogEnd = 3000
        Lighting.FogStart = 0
        b = Players.PlayerGui:findFirstChild("GuiAA"):Destroy()
        game.Workspace:FindFirstChild(A):Destroy()
        wait(2)
    end
end

1
PlayerGui isn't a Valid member of Players! I suggest using a In pairs loop to loop for all the players inside of Players and then Parent the Gui inside the player's PlayerGui. UserOnly20Characters 890 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Try doing this, put this code in a LocalScript instead, and use this revised code. Your problem is PlayerGui is not apart of players, but is apart of the Player that is in Players

Tell me if it works or not

local A = "event1"
local Lighting = game.Lighting
local Choos = 0
local Players = game.Players.LocalPlayer

while true do
    Choos = math.random(8)
    wait(4)
    if Choos == 2 then
        a = script:findFirstChild("GuiA"):Clone()
        a.Parent = Players.PlayerGui
        wait (5)
        a = Players.PlayerGui:findFirstChild("GuiA"):Destroy()
        b = script:findFirstChild("GuiAA"):Clone()
        b.Parent = Players.PlayerGui
        game.Lighting:findFirstChild(A):clone().Parent = game.Workspace
        Lighting.Brightness = 0.001
        Lighting.OutdoorAmbient = Color3.new(255/255, 255/255, 255/255)
        Lighting.ShadowColor = Color3.new(255/255, 255/255, 255/255)
        Lighting.FogColor = Color3.new(255/255, 255/255, 255/255)
        Lighting.FogEnd = 150
        Lighting.FogStart = 0
        wait (10) --Back normal
        Lighting.Brightness = 1
        Lighting.OutdoorAmbient = Color3.new(127/255, 127/255, 127/255)
        Lighting.ShadowColor = Color3.new(178/255, 178/255, 183/255)
        Lighting.FogColor = Color3.new(75/255, 75/255, 75/255)
        Lighting.FogEnd = 3000
        Lighting.FogStart = 0
        b = Players.PlayerGui:findFirstChild("GuiAA"):Destroy()
        game.Workspace:FindFirstChild(A):Destroy()
        wait(2)
    end
end


0
Players.Player.PlayerGui.GuiA.LocalScript:17: 'end' expected (to close 'if' at line 14) near 'until' minetrackmania 186 — 8y
0
There is nothing in line 17 or line 14 that has anything to do with the word 'if' User#9949 0 — 8y
Ad

Answer this question