Checking if a skip button got clicked in a loading screen

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local contentprovider = game.ContentProvider
local finished = false
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)


while wait() do
script.Parent.Loading.Loading.Text = "Loading Assets: ".. contentprovider.RequestQueueSize
	if script.Parent.Loading.Back.MouseButton1Click:Connect() or contentprovider.RequestQueueSize == 0 then --This is the line
		wait(3)
		game.Lighting.Ping:Play()
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
	local cam = workspace.CurrentCamera
	cam.CameraType = "Scriptable"
	local selected = workspace:WaitForChild("IntroCamera")
	cam.CameraSubject = selected
	cam.CFrame = selected.CFrame
		PlayerGui:SetTopbarTransparency(0)
		script.Parent.Loading.Visible = false
		game.Lighting.MenuBlur.Size = 25
		wait(1)
		game.Lighting.Ping:Play()
		game.Lighting.Menu:Play()
		script.Parent.Menu.Main.Visible = true
		game.Lighting.ButtonsEnabled.Value = true
		break
		end
		end

I have this loading screen and I have added a skip button, now I want to check if the button got clicked or if the game has loaded at the same time (3rd line in the while loop), but adding a button click to the if statement doesn’t seem to work in any way. Now I wanted to ask if anyone would have a solution for that.

How to fix

1. Add Remote Event into Replicated Storage

2. In the script make the remote event fire upon click

3. Go to the ServerScriptService and then make a code that happens when you fire the remote (Use a data store, or just use a table

I will reply to this with images when I’m home :smiley: