I’m trying to make where when the game starts, the gui/frames are invisible but if you press play, they become visible (with a LocalScript). However, it seems that game.Players.LocalPlayer.PlayerGui.WhateverGui.WhateverFrame.Visible will not work. Output says the ScreenGui is not a valid member of PlayerGui, even though it is when I checked. Can anyone help?
You’ll need to post the script (or at the very least the code block where the error happens), we can’t read your mind.
local character = player.CharacterAdded
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local PlayerGui = game.Players.LocalPlayer.PlayerGui
local defaultCFrame = camera.CFrame
local view = 150
local blur = game.Lighting.Blur
blur.Size = 10
function updateCamera()
camera.CFrame = game.Workspace.CameraPart.CFrame
end
game:GetService("RunService").RenderStepped:Connect(updateCamera)
script.Parent.Parent.HungerBarGui.HungerBarBG.Visible = false
script.Parent.Parent.StaminaGui.Background.Visible = false
script.Parent.Frame.PlayButton.MouseButton1Click:Connect(function()
wait(0.2)
blur.Size = 0
camera.CameraType = Enum.CameraType.Custom
PlayerGui.HungerBarGui.HungerBarBG.Visible = true
PlayerGui.StaminaGui.Background.Visible = true
script.Parent.Frame:Destroy()
script:Destroy()
end)```
local player = game.Players.LocalPlayer
local character = player.Character
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local PlayerGui = player:WaitForChild("PlayerGui")
local defaultCFrame = camera.CFrame
local view = 150
local blur = game.Lighting.Blur
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local PlayerGui = player:WaitForChild("PlayerGui")
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local defaultCFrame = camera.CFrame
local view = 150
local blur = game.Lighting:WaitForChild("Blur")
blur.Size = 10
function updateCamera()
camera.CFrame = game.Workspace.CameraPart.CFrame
end
game:GetService("RunService").RenderStepped:Connect(updateCamera)
script.Parent.Parent:WaitForChild("HungerBarGui"):WaitForChild("HungerBarBG").Visible = false
script.Parent.Parent:WaitForChild("StaminaGui"):WaitForChild("Background").Visible = false
script.Parent:WaitForChild("Frame"):WaitForChild("PlayButton").MouseButton1Click:Connect(function()
task.wait(0.2)
blur.Size = 0
camera.CameraType = Enum.CameraType.Custom
PlayerGui:WaitForChild("HungerBarGui"):WaitForChild("HungerBarBG").Visible = true
PlayerGui:WaitForChild("StaminaGui"):WaitForChild("Background").Visible = true
script.Parent:WaitForChild("Frame"):Destroy()
script:Destroy()
end)
Got it. I’ll try these scripts when I can. Thank you all!
1 Like