Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix infinity loading in the Old Miner Haven game ?

Soo in ber tweet he said he will no longer working in Miner Haven soo i have the old one but idk how to fix the infinity loading the script is long so i will show the other script in the answer part

local Ids = {}
local BaseUrl = game.ContentProvider.BaseUrl



local Loading
local Gui3D

if game:GetService("UserInputService").VREnabled then
	game.ReplicatedStorage:WaitForChild("Bers3DGui")
	Gui3D = require(game.ReplicatedStorage.Bers3DGui)
	Loading = Gui3D:GuiTo3D(script.LoadGui,5)
	Loading.Black.Transparency = 1
else
	Loading = script.LoadGui
end

spawn(function()
	game.ReplicatedStorage:WaitForChild("NightTime")
	local function Ambience()
		if game.ReplicatedStorage.NightTime.Value == true then
			game.Lighting.Ambient = Color3.new(0,0,0)
			game.Lighting.Brightness = 0
			game.Lighting.ColorShift_Bottom = Color3.new(100/255,100/255,0)
			game.Lighting.ColorShift_Top = Color3.new(45/255,84/255,86/255)
			game.Lighting.OutdoorAmbient = Color3.new(70/255,60/255,60/255)
			game.Lighting.FogStart = 0
			game.Lighting.FogEnd = 400
			if game.ReplicatedStorage:FindFirstChild("Mars") then
				game.Lighting.FogColor = Color3.new(180/255, 91/255, 50/255)
			else
				game.Lighting.FogColor = Color3.new(32/255,41/255,72/255)
			end			
			
		else
			game.Lighting.Ambient = Color3.new(100/255,100/255,100/255)
			game.Lighting.Brightness = 1
			game.Lighting.ColorShift_Bottom = Color3.new(1,1,1)
			game.Lighting.ColorShift_Top = Color3.new(45/255,84/255,86/255)
			game.Lighting.OutdoorAmbient = Color3.new(160/255,160/255,160/255)
			game.Lighting.FogStart = 0
			game.Lighting.FogEnd = 2000
			if game.ReplicatedStorage:FindFirstChild("Mars") then
				game.Lighting.FogColor = Color3.new(0, 0, 0)
			else
				game.Lighting.FogColor = Color3.new(64/255,255/255,217/255)
			end					
			
		end

	end
Ambience()	
end)

game.Players.LocalPlayer:WaitForChild("PlayerGui")

math.random(os.time())

Loading.Parent = game.Players.LocalPlayer.PlayerGui
Loading:WaitForChild("Center")
Loading.Center:WaitForChild("Load")
Loading.Center.Load:WaitForChild("Bar")
Loading.Center.Load.Bar.Visible = true


Loading.Center.Load.Twitter.Visible = true



game:GetService("GuiService").GuiNavigationEnabled = false
game:GetService("GuiService").AutoSelectGuiEnabled = true

Loading:WaitForChild("Black")
Loading.Black.Visible = true

Loading.Animation.Animate.Disabled = false

local CamLib = require(game.ReplicatedStorage.Kaz)

local Blur

game.ReplicatedFirst:RemoveDefaultLoadingScreen()
game.StarterGui:SetCoreGuiEnabled("All",false)

	repeat wait(0.1) until workspace.CurrentCamera ~= nil
	
	workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	
	workspace.CurrentCamera.CoordinateFrame = Loading.CoordFrame.Value + Vector3.new(0,1000,0)
	workspace.CurrentCamera.FieldOfView = 5
	
	CamLib.Tween(workspace.CurrentCamera.CFrame, Loading.CoordFrame.Value, Loading.CoordFrame.Value + (Loading.CoordFrame.Value.lookVector * 1000), 7, nil, false, 30)
--	workspace.CurrentCamera:Interpolate(Loading.CoordFrame.Value, Loading.CoordFrame.Value + (Loading.CoordFrame.Value.lookVector * 1000),5)
	--[[
	if game.VIPServerId == "" then
		workspace.CurrentCamera.CoordinateFrame = Loading.CoordFrame.Value
	else
		workspace.CurrentCamera.CoordinateFrame = Loading.CoordFrameIs.Value
	end
	]]
	
	if true then
		game.ReplicatedStorage:WaitForChild("Blur")
		Blur = game.ReplicatedStorage.Blur:Clone()
		Blur.Parent = workspace.CurrentCamera
	end
	
local EarlyTarget

game.ReplicatedStorage:WaitForChild("Items")

for i,Item in pairs(game.ReplicatedStorage.Items:GetChildren()) do
	table.insert(Ids,"http://roblox.com/asset?Id="..Item.ThumbnailId.Value)
end

function scan(Object)
	if Object:IsA("ImageLabel") or Object:IsA("ImageButton") then
		table.insert(Ids,Object.Image)
	elseif Object:IsA("Sound") then
		table.insert(Ids,Object.SoundId)
	end
	for i,v in pairs(Object:GetChildren()) do
		scan(v)
	end
end
--Loading.Black.Visible = false

game.ReplicatedStorage:WaitForChild("GUI")

local GUI
local USI = game:GetService("UserInputService")
local IsMobile = USI.TouchEnabled and not(USI.MouseEnabled) and not(USI.KeyboardEnabled)
if game:GetService("UserInputService").VREnabled then
	GUI = Gui3D:GuiTo3D(game.ReplicatedStorage.GUI, 10)
elseif game:GetService("GuiService"):IsTenFootInterface() or game:GetService("UserInputService").GamepadEnabled or IsMobile then
	GUI = game.ReplicatedStorage.OldGui
else
	GUI = game.ReplicatedStorage.GUI
end

scan(GUI)
scan(Loading)





--[[
spawn(function()
	repeat wait() until game.Players.LocalPlayer.Character
	workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	if Loading ~= nil and Loading:FindFirstChild("CoordFrame") ~= nil then
		workspace.CurrentCamera.CoordinateFrame = Loading.CoordFrame.Value
		
		if game.VIPServerId == "" then
			workspace.CurrentCamera.CoordinateFrame = Loading.CoordFrame.Value
		else
			workspace.CurrentCamera.CoordinateFrame = Loading.CoordFrameIs.Value
		end
	
	end		

end)
]]
	if game:GetService("UserInputService").TouchEnabled then
		game.Players.LocalPlayer.PlayerGui.TouchGui.TouchControlFrame.Visible = false
	end

wait(1)


local Queue = #Ids


local DoneLoading = false

spawn(function()
	game:GetService("ContentProvider"):PreloadAsync(Ids)
	DoneLoading = true
end)
spawn(function() -- Don't let loading assets take longer than 15 seconds
	wait(15)
	DoneLoading = true
end)

--[[
for Num,Id in pairs(Ids) do
	game.ContentProvider:Preload(Id)
end
]]

	
spawn(function()
	
	wait(2)
	
	for i=1,30 do
		Loading.Black.Transparency = Loading.Black.Transparency + (1/30)
		Loading.Black.TextStrokeTransparency = Loading.Black.TextStrokeTransparency + (1/20)
		wait(0.08)
	end
	Loading.Black.Visible = false

end)

local StartTime = tick()



repeat 
	game:GetService("RunService").Heartbeat:wait()
	local Progress = (Queue-game.ContentProvider.RequestQueueSize)/Queue
	Loading.Center.Load.Bar.Progress.Size = UDim2.new(Progress,0,0.9,0)
until DoneLoading


Loading.Center.Load.Bar.Progress.Size = UDim2.new(1,0,0.9,0)

wait(1)
Loading.Center.Load.Visible = false
local EndPosition 
if workspace.CurrentCamera.ViewportSize.Y < 650 then
	Loading.Logo.Size = UDim2.new(0,495,0,450)
	EndPosition = UDim2.new(0.5, -235, -0.2, 0)
	Loading.Logo.Position = UDim2.new(0.5, -235, 0.5, -400)
	Loading.Play.Position = UDim2.new(0.5,-300,0.3,0)
	Loading.Solo.Position = UDim2.new(0.5,0,0.3,0)
elseif workspace.CurrentCamera.ViewportSize.Y < 950 then
	EndPosition = UDim2.new(0.5, -470, 0.2, -200)
	Loading.Logo.Position = UDim2.new(0.5, -470, 0.5, -400)
else
	EndPosition = UDim2.new(0.5, -470, 0.3, -300)
	Loading.Logo.Position = UDim2.new(0.5, -470, 0.5, -400)
end


Loading.Logo:TweenPosition (
  	EndPosition,
    Enum.EasingDirection.Out,
    Enum.EasingStyle.Sine,
    1,
    true)
spawn(function()
	for i=1,25 do
		Loading.Logo.ImageTransparency = 1-i/25
		wait()
	end
end)

wait(0.4)
Loading.FireworkLaunch:Play()
wait(0.4)

Loading.FireworkLeft.Position = UDim2.new(0.5, -470, 0.5, -270)

Loading.FireworkLeft:TweenPosition (
  	UDim2.new(0.5, -550, 0.3, -260),
    Enum.EasingDirection.Out,
    Enum.EasingStyle.Sine,
    0.6,
    true)
spawn(function()
	for i=1,50 do
		Loading.FireworkLeft.ImageTransparency = 1-i/100
		wait(0.05)
	end
end)

wait(0.1)

Loading.FireworkRight.Position = UDim2.new(0.5, -470, 0.5, -270)

Loading.FireworkRight:TweenPosition (
  	UDim2.new(0.5, -400, 0.3, -260),
    Enum.EasingDirection.Out,
    Enum.EasingStyle.Sine,
    0.6,
    true)
spawn(function()
	for i=1,50 do
		Loading.FireworkRight.ImageTransparency = 1-i/100
		wait(0.05)
	end
end)

wait(0.3)
Loading.FireworkExplode:Play()

wait(1.5)




--[[
spawn(function()
	for i=1,50 do
		Loading.Logo.Position = UDim2.new(0.5, -470, 0.5, (-250)-i)
		Loading.Logo.ImageTransparency = 1 - (i/50)
		wait(0.05)
	end
end)
wait(0.5)
spawn(function()
	for i=1,25 do
		Loading.FireworkLeft.Position = UDim2.new(0.5, -470-i, 0.5, (-300)-i)
		Loading.FireworkLeft.ImageTransparency = 1 - (i/35)
		wait()
	end
end)
wait(0.3)
spawn(function()
	for i=1,25 do
		Loading.FireworkRight.Position = UDim2.new(0.5, -470+i, 0.5, (-300)-i)
		Loading.FireworkRight.ImageTransparency = 1 - (i/35)
		wait()
	end
end)
--]]

Loading.Play.Visible = true

print("VIP ID: "..game.VIPServerId)
if not workspace:FindFirstChild("Private") then
	Loading.Solo.Visible = true
else
	Loading.Solo.Visible = false
	Loading.Play.Position = UDim2.new(0.5,-150,0.74,0)
end

1 comment

0

We only help people with work that is their own.

1 answer

local Tycoon

function getTycoon(player)
	for i,v in pairs(workspace.Tycoons:GetChildren()) do
		if game.Players:FindFirstChild(v.Owner.Value) == player then
			Tycoon = v
			return v
		end
	end
	return nil
end

local connection

local Requested = false

function CloseGui()	
	if Loading then	
		for i,Child in pairs(Loading:GetChildren()) do
			if Child.Name ~= "Blackout" then
				Child:Destroy()
			end
		end
		
--		repeat wait() until game.Players.LocalPlayer.Character ~= nil

		
		workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
		CamLib.Tween(EarlyTarget, EarlyTarget, Tycoon.Base.CFrame + Vector3.new(0,10,0), 3, nil, true, 10, false, true)

		
		if game:GetService("UserInputService").GamepadEnabled then
		--	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
		end
		
		Loading.Blackout.BackgroundTransparency = 1
		Loading.Blackout.Visible = true

		wait(2)		
		
		if not game:GetService("UserInputService").GamepadEnabled then
			spawn(function()
				for i=1,20 do
					if Loading:FindFirstChild("Blackout") then
						Loading.Blackout.BackgroundTransparency = Loading.Blackout.BackgroundTransparency - 1/20
						wait()
					end
				end
			end)
		end
		
		wait(2)		
		
		workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
		workspace.CurrentCamera.CameraType = Enum.CameraType.Custom		
		
		--[[
		
		local GUI = game.ReplicatedStorage.GUI:Clone()
		GUI.Inventory.Blackout.BackgroundTransparency = 0
		if game:GetService("UserInputService").VREnabled then
			GUI = Gui3D:GuiTo3D(GUI, 10)
			GUI.Inventory.Blackout.BackgroundTransparency = 1
		end
		
		
		
		]]

		local function VerifyGui()
			local GUI
			local USI = game:GetService("UserInputService")
			local IsMobile = USI.TouchEnabled and not(USI.MouseEnabled) and not(USI.KeyboardEnabled)
			if game:GetService("UserInputService").VREnabled then
				GUI = Gui3D:GuiTo3D(game.ReplicatedStorage.GUI:Clone(), 10)
			elseif game:GetService("GuiService"):IsTenFootInterface() or game:GetService("UserInputService").GamepadEnabled or IsMobile then
				GUI = game.ReplicatedStorage.OldGui:Clone()
				GUI.Name = "GUI"
			else
				GUI = game.ReplicatedStorage.GUI:Clone()
			end
			GUI.Enabled = true

			GUI.Inventory.Blackout.Visible = true
			GUI.Inventory.Visible = true
			
			workspace.CurrentCamera.FieldOfView = 70
			workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
			workspace.CurrentCamera.CameraType = "Custom"			
			
			GUI.Parent = game.Players.LocalPlayer.PlayerGui
			print(GUI:GetFullName())
		end
		
		VerifyGui()

		--[[
		spawn(function()
			wait(1)
			if Player.PlayerGui:FindFirstChild("GUI") == nil then
				VerifyGui()
			end
		end)
		]]

		
		Loading:Destroy()
		
		wait(2)
		
		game.StarterGui:SetCoreGuiEnabled("All",true)	
		if game:GetService("UserInputService").TouchEnabled and (workspace.CurrentCamera.ViewportSize.X < 1000 or workspace.CurrentCamera.ViewportSize.Y < 600)	then
			game.StarterGui:SetCoreGuiEnabled("Backpack",false)
		end
		
		script:Destroy()
	end
end



local Completed = false

local function PlaySolo()
	if not Requested and Loading.Solo.ImageColor3 ~= Color3.new(1,0.4,0.4) then
		Requested = true
		Loading.Play.ImageColor3 = Color3.new(1,1,1)
		Loading.Play.Selection.Visible = false
		Loading.Solo.Selection.Visible = false
		Loading.Solo.ImageColor3 = Color3.new(0.6,0.8,1)
		Loading.LoadingText.TextColor3 = Color3.new(0.6,0.8,1)
		Loading.LoadingText.Visible = true	
		if game.Players.LocalPlayer:FindFirstChild("Mars") then
			Loading.LoadingText.Text = "Teleporting to Mars"
			Loading.LoadingText.TextColor3 = Color3.new(1,0.6,0.2)
		else
			Loading.LoadingText.Text = "Teleporting to private island"
		end	
		
		
		CamLib.Tween(Loading.CoordFrame.Value, Loading.CoordFrame.Value + Vector3.new(0,1000,0), Loading.CoordFrame.Value + (Loading.CoordFrame.Value.lookVector * 1000), 4, nil, false, 1)
	
		wait(4)	
	
		local Success = game.ReplicatedStorage.PlaySolo:InvokeServer()
		if not Success then
			Loading.LoadingText.TextColor3 = Color3.new(1,0.4,0.4)
			Loading.LoadingText.Text = "Teleporting failed. Try joining server."
			Loading.Solo.ImageColor3 = Color3.new(1,0.4,0.4)
			Requested = false
			if game:GetService("UserInputService").GamepadEnabled then
				Loading.SelectedButton.Value = Loading.Play
			end
		end
	end
end

local function RequestLoad() -- new saving system
	if connection then
		connection:disconnect()
	end
	if not Requested then
		Requested = true
		Loading.Play.ImageColor3 = Color3.new(0.6,0.8,1)
		Loading.Play.Selection.Visible = false
		Loading.Solo.Selection.Visible = false
		Loading.Solo.ImageColor3 = Color3.new(1,1,1)
		Loading.LoadingText.TextColor3 = Color3.new(0.6,0.8,1)
		Loading.LoadingText.Visible = true
		local Down = game.ReplicatedStorage.LookingDown.Value
		spawn(function()
			repeat wait(0.1) until getTycoon(game.Players.LocalPlayer) ~= nil
				workspace.CurrentCamera.CameraType = "Scriptable"
					
				EarlyTarget = workspace.CurrentCamera.CFrame:lerp(Tycoon.Base.CFrame + Vector3.new(0,100,0),0.9)
					
				CamLib.Tween(workspace.CurrentCamera.CFrame, workspace.CurrentCamera.CFrame, Tycoon.Base.CFrame + Vector3.new(0,10,0), 0.5, nil, true, 30, true)
					
				spawn(function()
					wait(0.5)			
						
					CamLib.Tween(workspace.CurrentCamera.CFrame, EarlyTarget, Tycoon.Base.CFrame + Vector3.new(0,10,0), 2, nil, true, 80)
				end)
		end)

				
		Loading.LoadingText.Text = "Loading data..."
	


		
		local Result, Success, Errormsg, DataCount = game.ReplicatedStorage.LoadPlayerData:InvokeServer()
		if DataCount then
			print("Your data is "..DataCount.." characters long.")
		end				
			
		if not Result then
			if Success then
				Loading.LoadingText.TextColor3 = Color3.new(1,0.5,0.5)
				CamLib.Tween(workspace.CurrentCamera.CFrame, Loading.CoordFrame.Value, Loading.CoordFrame.Value + (Loading.CoordFrame.Value.lookVector * 1000), 3, nil, true, 30)

				for i=1,60 do
					Loading.LoadingText.Text = "Failed to connect to ROBLOX! Retrying in: ("..(61-i)..")"
					wait(1)
				end
				Requested = false
				RequestLoad()
			else
				Loading.LoadingText.Text = "Error loading data! Try again later!"
				Loading.LoadingText.TextColor3 = Color3.new(1,0.7,0.6)
				print("ERROR LOADING IN PLAYER DATA:")
				warn(Errormsg)
				error("Please send a screenshot of this to @berezaagames on twitter!")
			end
		else
			wait()
			math.randomseed(tick())	
			wait()	
			math.random(4,6)
			math.random(1,2)
			
			local Name = game.Players.LocalPlayer.Name
			local Strings = {
				"Prepare to INNOVATE!","The sky is the limit!","Build beyond your imagination!","Welcome home!", "Welcome to Miner's Haven!","Have a blast!", "Have fun!", "Enjoy!", "Stay innovative!"
			}
			math.random(1,#Strings)
			local WelcomeMessage = Strings[ math.random(1,#Strings) ]
	
				
			Loading.LoadingText.Text = WelcomeMessage
			Loading.LoadingText.TextColor3 = Color3.new(0.5,1,0.6)				
			
			spawn(function()
				wait(1)
				for i=1,16 do
					wait(0.1)
					if Blur	then
						Blur.Size = Blur.Size - 1
					end
				end
			end)
			if workspace.CurrentCamera:FindFirstChild("Colors") then
				workspace.CurrentCamera.Colors:Destroy()
			end			
			
	
			repeat wait() until game.Players.LocalPlayer:FindFirstChild("BaseDataLoaded")
			Completed = true
	
		end
	end
end

local MoveDB = true
local function onInputChanged(input,gameProcessed)
	if input.KeyCode == Enum.KeyCode.Thumbstick1 and MoveDB and not Requested then
		if math.abs(input.Position.X) > 0.5 then
			MoveDB = false
			if Loading.SelectedButton.Value == Loading.Play and Loading.Solo.Visible then
				Loading.SelectedButton.Value = Loading.Solo
			else
				Loading.SelectedButton.Value = Loading.Play
			end
			wait(0.55)
			MoveDB = true
		end
	end	
end
 
game:GetService("UserInputService").InputChanged:connect(onInputChanged)


Loading.Play.Selection.Visible = false
Loading.Solo.Selection.Visible = false
if game:GetService("UserInputService").GamepadEnabled then
	Loading.Play.Selection.Visible = true
	Loading.Solo.Selection.Visible = false
	Loading.Play.ImageColor3 = Color3.new(7/255, 234/255, 128/255)
	Loading.Solo.ImageColor3 = Color3.new(1,1,1)
	Loading.SelectedButton.Value = Loading.Play
	
	local eDebounce = true
	connection = game:GetService("UserInputService").InputBegan:connect(function(input)
		if input.UserInputType == Enum.UserInputType.Gamepad1 then
			if Loading.SelectedButton.Value == Loading.Play then
				if not Requested then
					spawn(RequestLoad)
				end
			else
				if not Requested then
					spawn(PlaySolo)
				end
			end
		end
	end)
end

Loading.SelectedButton.Changed:connect(function()
	for i,Button in pairs(Loading:GetChildren()) do
		if Button:IsA("ImageButton") then
			Button.ImageColor3 = Color3.new(1,1,1)
			Button.Selection.Visible = false
		end
	end
	local SelectedButton = Loading.SelectedButton.Value
	SelectedButton.ImageColor3 = Color3.new(7/255, 234/255, 128/255)
	SelectedButton.Selection.Visible = true
end)


game.ReplicatedStorage.DataLoadedIn.OnClientEvent:connect(CloseGui)
for i,Button in pairs(Loading:GetChildren()) do
	if Button:IsA("ImageButton") then
		Button.MouseEnter:connect(function()
			if Button.ImageColor3 == Color3.new(1,1,1) and not Requested then
				Button.ImageColor3 = Color3.new(7/255, 234/255, 128/255)
			end
		end)
		Button.MouseLeave:connect(function()
			if Button.ImageColor3 == Color3.new(7/255, 234/255, 128/255) then
				Button.ImageColor3 = Color3.new(1,1,1)
			end
		end)
	end
end

Loading.Play.MouseButton1Click:connect(RequestLoad)
Loading.Solo.MouseButton1Click:connect(PlaySolo)




print("Welcome to the print output, are you not just perfect? Find any errors here? Please screenshot and tweet berezaa at @berezaagames!")
warn("If you are the first to report a large or game-breaking bug, you may win prizes such as special items and Robux! (We'll see!)")

This discussion is preserved as it was. New answers, comments, and votes are closed.