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

Custom Disaster script?

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 comment

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.

1 answer

✓ Accepted answer

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


2 comments

0

Players.Player.PlayerGui.GuiA.LocalScript:17: 'end' expected (to close 'if' at line 14) near 'until'

0

There is nothing in line 17 or line 14 that has anything to do with the word 'if'

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