Announcements is not a valid member of PlayerGui "Players.rytansal_alt.PlayerGui"

The issue with this if I add a waitforchild on the announcements line, it will not run the remoteevents for some reason..

Script:

game.ReplicatedStorage.MovePlayer:FireServer("no")
game.ReplicatedStorage.PlayerCantMove:FireServer("no")
game.Players.LocalPlayer.PlayerGui.CoinsGui.Enabled = false
game.Players.LocalPlayer.PlayerGui.MainUI.Enabled = false
game.Players.LocalPlayer.PlayerGui.Announcements.Enabled = false
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
workspace.CurrentCamera.CameraType = "Scriptable"
script.Parent.Enabled = true
local t = game:GetService("TweenService")
local i = TweenInfo.new(0.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local c = t:Create(script.Parent.SkipButton, i, {BackgroundTransparency = 0})
local c2 = t:Create(script.Parent.SkipButton.UIStroke, i, {Transparency = 0})
local c3 = t:Create(script.Parent.SkipButton, i, {TextTransparency = 0})
local c4 = t:Create(script.Parent.SkipButton["Drop Shadow"], i, {ImageTransparency = 0.45})

spawn(function()
	task.wait(2)
	script.Parent.SkipButton.Visible = true
	c:Play()
	c2:Play()
	c3:Play()
	c4:Play()
end)

repeat task.wait() until game:IsLoaded() == true
task.wait(6)
script.Parent:FindFirstChild("LoadingFinished?").Value = true
2 Likes

Use :WaitForChild() when getting all of the ScreenGuis. These need to first be loaded in before they exist on the client, and sometimes the scripts load first!

If the remotes aren’t firing because of this, use breakpoints to see what the code is actually doing.

Honest mode activated:
Bro, what code is this?
You aren’t optimizing stuff; you are DEOPTIMIZING STUFF :sob:
Use service auto complete please:
https://create.roblox.com/store/asset/11380642657/

Next, you use a deprecated function (spawn).
Refer to using task.spawn and ideally get rid of it

same code but more barable:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local TweenService = game:GetService("TweenService")

local Plr = Players.LocalPlayer::Player
local PlayerGui = Plr:WaitForChild("PlayerGui")::PlayerGui
local Announcements = PlayerGui:WaitForChild("Announcements")::ScreenGui
local MainUI = PlayerGui:WaitForChild("MainUI")::ScreenGui
local CoinsGui = PlayerGui:WaitForChild("CoinsGui")::ScreenGui
local Camera = workspace.CurrentCamera
local Parent = script.Parent::ScreenGui
local SkipButton = Parent.SkipButton::GuiObject

ReplicatedStorage.MovePlayer:FireServer("no")
ReplicatedStorage.PlayerCantMove:FireServer("no")
CoinsGui.Enabled = false
MainUI.Enabled = false
Announcements.Enabled = false
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
Camera.CameraType = Enum.CameraType.Scriptable

Parent.Enabled = true

local i = TweenInfo.new(0.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local c = TweenService:Create(SkipButton, i, {BackgroundTransparency = 0})
local c2 = TweenService:Create(SkipButton.UIStroke, i, {Transparency = 0})
local c3 = TweenService:Create(SkipButton, i, {TextTransparency = 0})
local c4 = TweenService:Create(SkipButton["Drop Shadow"], i, {ImageTransparency = 0.45})


if not game:IsLoaded() then game.Loaded:Wait() end
task.wait(2)
SkipButton.Visible = true
c:Play()
c2:Play()
c3:Play()
c4:Play()
task.wait(4)
script.Parent:FindFirstChild("LoadingFinished?").Value = true
2 Likes

This is completely my fault, I’m a really lazy person so really when it comes to code it just make it horrible :grinning_face_with_smiling_eyes:

Did I cook?

-- rytansal, avocado (@avodey) -w-

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local Shared = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local LoadScreen: ScreenGui = script.Parent
local SkipButton: TextButton = LoadScreen:WaitForChild("SkipButton")

local MovePlayer: RemoteEvent = Shared:WaitForChild("MovePlayer")
local PlayerCantMove: RemoteEvent = Shared:WaitForChild("PlayerCantMove")

--\\ Constants

local STYLE = TweenInfo.new(0.375, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)

--\\ Private Fields

local camera = workspace.CurrentCamera

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
if not playerGui then return end

--\\ Connections

do -- Initialize
	MovePlayer:FireServer("no")
	PlayerCantMove:FireServer("no")

	playerGui:WaitForChild("CoinsGui").Enabled = false
	playerGui:WaitForChild("MainUI").Enabled = false
	playerGui:WaitForChild("Announcements").Enabled = false

	LoadScreen.Enabled = true
	camera.CameraType = "Scriptable"
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
end

task.delay(2, function() -- Skip Button
	SkipButton.Visible = true
	TweenService:Create(SkipButton, STYLE, {BackgroundTransparency = 0}):Play()
	TweenService:Create(SkipButton.UIStroke, STYLE, {Transparency = 0}):Play()
	TweenService:Create(SkipButton, STYLE, {TextTransparency = 0}):Play()
	TweenService:Create(SkipButton["Drop Shadow"], STYLE, {ImageTransparency = 0.45}):Play()
end)

do -- Yield until Loaded
	while not game:IsLoaded() do
		game.Loaded:Wait()
	end

	task.wait(0.125)
	LoadScreen["LoadingFinished?"].Value = true
end
1 Like

Ok I made a mistake on my part, the reason why I said this was because I wanted to make it so that you don’t hear the sound effects in the lobby, so i just make it teleport to a different part faraway from the sounds. This was my mistake, thanks for the help however

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.