Localscript can't change find frame under a ScreenGui or change the value of humanoid.Walkspeed

I am trying to make a black screen fade in when a round ends in my game to hide maps spawning or despawning, then fade out when the process is finished. It also simultaneously freezes the player while the black screen is active. The problem being the value of humanoid walk speed only changes within the script (while the printing does show the values are changing, nothing actually happens in-game), and the game is unable to find any children of the screengui.

My Code
```
-- SERVER SCRIPT --

local mapLoaded = false
local gameLoaded = true
local intermissionTime = 10
local roundTime = 10
local sendMapLoaded = game.ReplicatedStorage.Remotes.RemoteEvents.BlackScreen
local debris = game:GetService("Debris")
local players = game:GetService("Players")



while gameLoaded do
	-- SETUP --
	local grassyMap = game.ServerStorage.Maps.GrassyMap:Clone()
	
	-- INTERMISSION -- 
	mapLoaded = false
	sendMapLoaded:FireAllClients(mapLoaded)
	--players.PlayerAdded:Connect(function()
	--	sendMapLoaded:FireAllClients(mapLoaded)
	--end)
	
	-- Load Players back in main menu
	workspace.MainMenuSpawn.MainSpawn.Enabled = true
	
	for num,player in pairs(game.Players:GetPlayers()) do
		player:LoadCharacter()
	end
	print("Map False, Spawn Enabled, Players Spawn")
	wait(intermissionTime)
	print("Intermission Over")
	
	-- BEGIN GAME --
	
	-- Load Map(s)
	grassyMap.Parent = workspace -- later on add random map selection
	
	-- Spawn Players
	workspace.MainMenuSpawn.MainSpawn.Enabled = false
	print("Main Spawn Disbaled")
	
	for num,player in pairs(game.Players:GetPlayers()) do
		player:LoadCharacter()
	end
	
	mapLoaded = true
	sendMapLoaded:FireAllClients(mapLoaded)
	--players.PlayerAdded:Connect(function()
	--	sendMapLoaded:FireAllClients(mapLoaded)
	--end)
	print("FireAllClient True Sent/ Player Loaded")
	
	wait(roundTime)
	print("Waited")
	
	-- Remove Map(s)
	grassyMap:Destroy()
	print("Map Removed")
end

-- LOCAL SCRIPT --
local player = game.Players.LocalPlayer
local playerGUI = player.PlayerGui
local character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local blackScreen = playerGUI.GameGui.BlackOutGui
local runService = game:GetService("RunService")

local function turnOn(mapLoaded)
	if mapLoaded == false then
		blackScreen.Frame.BackgroundTransparency = 0
		print(blackScreen.Enabled)
		humanoid.WalkSpeed = 0
		print(humanoid.WalkSpeed)
	end
	if mapLoaded == true then
		blackScreen.Frame.BackgroundTransparency = 1
		humanoid.WalkSpeed = 16
		print(humanoid.WalkSpeed)
	end
end

game.ReplicatedStorage.Remotes.RemoteEvents.BlackScreen.OnClientEvent:Connect(turnOn)

--runService.RenderStepped:Connect(function()
--	print(humanoid.WalkSpeed)
--end)
```
Folder Placement

I’ve already tried moving the screen GUI out of a folder and directly under PlayerGui, moving the Gui into a different folder, removing the humanoid. Rewriting my code, and looking around this forum. All of which have returned no solutions.

To add extra, while I could put the screengui in serverstorage then clone it onto the player’s gui when they need it, I don’t think it is tweenable so that idea is out the window already.

You mentioned that the game is unable to find any children of the screengui. Have you tried if using WaitForChild would solve that? Everything does not exist on the client yet when local scripts start running, so WaitForChild is sometimes needed in local scripts.

And is the ResetOnSpawn property of the screengui true or false? If it’s true, your local script will refer to the wrong screengui object when the player respawns. So make sure that you have set it to false.

You also mentioned that the walkspeed of the humanoid does not change in the game, but the local script prints that it’s changed. That’s because you always change the walkspeed of the humanoid of the player’s first character. You only set values for the character and humanoid variables once, so after the player has respawned, the turnOn function changes the Walkspeed of the humanoid parented to the first character, which is parented to nil.

This can probably be solved simply by connecting a function to the player.CharacterAdded and updating the character and humanoid variables in that function.

You mentioned that the game is unable to find any children of the ScreenGui. Have you tried if using WaitForChild would solve that?

As much as I would have loved for it to be that simple, I have already tried that and get the"Infinite yield possible" warning. Sorry I failed to mention that.

And is the ResetOnSpawn property of the ScreenGui true or false?

I set it to false and it still is returning errors/warnings

That’s because you always change the walkspeed of the humanoid of the player’s first character.

This seems like it would be the solution, for walkspeed at least, how would I implement this?

Well, I’m not sure how to solve the GUI problem then, but updating the character and humanoid variables could probably be done by adding this somewhere below the lines where the variables are created (to the end of your current local script, for example).

player.CharacterAdded:Connect(function(char)
    character, humanoid = char, char:WaitForChild("Humanoid")
end)