Hello there,
Today, on Roblox Studio, I decided to make a LocalScript
on a primary frame that while firing other events alongside services that were counted in the code lines, would also enable other ScreenGUIs
:
local Game_Workspace = game.Workspace
local Game_StarterGui = game.StarterGui
local Game_Terrain = game.Workspace.Terrain
local Game_Assets = {Game_Workspace, Game_StarterGui, Game_Terrain}
local Players = game:GetService("Players")
local ContentProvider = game:GetService("ContentProvider")
--local Game_Camera = game.Workspace.Camera
--local Player = game.Players.LocalPlayer.Character
local BadgeGUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("BadgeGui")
local CoinGUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("CoinGui")
local DiamondGUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("DiamondGui")
Players.PlayerAdded:Connect(function(player)
print("Welcome" .. " @" .. player.Name .. ".")
end)
--Game_Camera.CameraSubject = game.Workspace.CameraPart
--Game_Camera.CameraType = Enum.CameraType.Track
--Game_Camera.CFrame = CFrame.new(Vector3.new(game.Workspace.CameraPart.Position + game.Workspace.CameraPart.Orientation))
task.wait(3.75)
local MainGUI = Players.LocalPlayer.PlayerGui.MainFrame
MainGUI.LoadingFrame.X.TextTransparency = 1
MainGUI.LoadingFrame.Roblox_Logo.ImageTransparency = 1
MainGUI.LoadingFrame.Steampunk_Logo.ImageTransparency = 1
MainGUI["English Forest 14 (SFX)"]:Play()
BadgeGUI.Enabled = false
BadgeGUI.BadgeFrame.Visible = false
CoinGUI.Enabled = false
CoinGUI.CoinFrame.Visible = false
DiamondGUI.Enabled = false
DiamondGUI.DiamondFrame.Visible = false
task.wait(5)
if MainGUI then
while true do
local number = 1
local FullView = number - 0.1
task.wait(0.01)
MainGUI.LoadingFrame.X.TextTransparency = FullView
if MainGUI.LoadingFrame.X.TextTransparency <= 0 then
print(MainGUI.LoadingFrame.X.TextTransparency)
-- break
end
MainGUI.LoadingFrame.Roblox_Logo.ImageTransparency = FullView
if MainGUI.LoadingFrame.Roblox_Logo.ImageTransparency <= 0 then
print(MainGUI.LoadingFrame.Roblox_Logo.ImageTransparency)
-- break
end
MainGUI.LoadingFrame.Steampunk_Logo.ImageTransparency = FullView
if MainGUI.LoadingFrame.Steampunk_Logo.ImageTransparency <= 0 then
print(MainGUI.LoadingFrame.Steampunk_Logo.ImageTransparency)
-- break
end
task.wait(10)
break
end
end
task.wait(5)
game.Workspace.SpawnLocation:Destroy()
ContentProvider:PreloadAsync(Game_Assets)
print("Loaded")
task.wait(5)
--Game_Camera.CameraSubject = Player:FindFirstChildOfClass("Humanoid")
--Game_Camera.CameraType = Enum.CameraType.Custom
MainGUI["English Forest 14 (SFX)"]:Stop()
MainGUI.Enabled = false
BadgeGUI.Enabled = true
BadgeGUI.BadgeFrame.Visible = true
CoinGUI.Enabled = true
CoinGUI.CoinFrame.Visible = true
DiamondGUI.Enabled = true
DiamondGUI.DiamondFrame.Visible = true
Players.PlayerRemoving:Connect(function(player)
print("@" .. player.Name, "left the experience.")
end)
(NOTE: Those that are as in comments were moved to other properties at the game on the Studio engine)
Once testing the script while playing, it prints errors upon the Output
saying that it is trying to attempt to index nil within enabling the GUI:
This happens to have BadgeGUI, CoinGUI, and DiamondGUI + Its frames are false and true in certain moments.
Within the result, I want to know how I can solve this problem to truly make it activated using .Enabled
function. If anyone can help me with this, I would appreciate it a lot!
Thank you!