ClientSceneFramework.task=task local W=false return function(y)if W then error("\067\108\105\101\110\116 \083\099\101\110\101 \070\114\097\109\101\119\111\114\107 \104\097\115 \097\108\114\101\097\100\121 \098\101\101\110 \099\097\108\108\101\100")return end if y then for W,y in pairs(y)do ClientSceneFramework[W]=y end end ClientSceneFramework.handleAnchorClientForSceneTransition=ClientSceneFramework.AnchorClientForSceneTransitionModule ClientSceneFramework.AnchorClientForSceneTransition.OnClientEvent:Connect(ClientSceneFramework.handleAnchorClientForSceneTransition)ClientSceneFramework.handleUnloadSceneClientRemoteEvent=ClientSceneFramework.UnloadSceneClientRemoteEventModule(ClientSceneFramework.DefaultUnloadScene)ClientSceneFramework.UnloadSceneClientRemoteEvent.OnClientEvent:Connect(ClientSceneFramework.handleUnloadSceneClientRemoteEvent)ClientSceneFramework.handleLoadSceneRemoteEvent=ClientSceneFramework.LoadSceneRemoteEventModule.LoadSceneRemoteEventFn ClientSceneFramework.LoadSceneRemoteEvent.OnClientEvent:Connect(ClientSceneFramework.handleLoadSceneRemoteEvent)ClientSceneFramework.handleGetCurrentSceneEnvironment=ClientSceneFramework.GetCurrentSceneEnvironmentModule ClientSceneFramework.GetCurrentSceneEnvironment.OnInvoke=ClientSceneFramework.handleGetCurrentSceneEnvironment ClientSceneFramework.InitModule()W=true return ClientSceneFramework end

ClientSceneFramework.task = task

local hasBeenCalled = false

return function(stubs)
	if hasBeenCalled then
		error("Client Scene Framework has already been called")
		return
	end

	-- Used for testing only
	if stubs then
		for i, v in pairs(stubs) do
			ClientSceneFramework[i] = v
		end
	end

	-- Anchor Client For Scene Transition: Anchors a client while they're transitioning so their velocity doesn't launch people
	ClientSceneFramework.handleAnchorClientForSceneTransition =
		ClientSceneFramework.AnchorClientForSceneTransitionModule
	ClientSceneFramework.AnchorClientForSceneTransition.OnClientEvent:Connect(
		ClientSceneFramework.handleAnchorClientForSceneTransition
	)

	-- Unload Scene Client Remote Event: removes their scene
	ClientSceneFramework.handleUnloadSceneClientRemoteEvent = ClientSceneFramework.UnloadSceneClientRemoteEventModule(
		ClientSceneFramework.DefaultUnloadScene
	)
	ClientSceneFramework.UnloadSceneClientRemoteEvent.OnClientEvent:Connect(
		ClientSceneFramework.handleUnloadSceneClientRemoteEvent
	)

	-- Load Scene Remote Event: Loads a scene for the client and tells them they're ready to transition
	ClientSceneFramework.handleLoadSceneRemoteEvent =
		ClientSceneFramework.LoadSceneRemoteEventModule.LoadSceneRemoteEventFn
	ClientSceneFramework.LoadSceneRemoteEvent.OnClientEvent:Connect(ClientSceneFramework.handleLoadSceneRemoteEvent)

	-- Get Current Scene Environment: Returns the scene's client folder from workspace
	ClientSceneFramework.handleGetCurrentSceneEnvironment = ClientSceneFramework.GetCurrentSceneEnvironmentModule
	ClientSceneFramework.GetCurrentSceneEnvironment.OnInvoke = ClientSceneFramework.handleGetCurrentSceneEnvironment

	ClientSceneFramework.InitModule()

	hasBeenCalled = true

	return ClientSceneFramework
end
