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)
```
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.