Any ideas to make this code any cleaner?

Hey! I want your opinion on how more cleaner, more efficient, and more compact, better looking code. Yes, all the services are necessary for the bottom blocks of code to run.

local PlayersService = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local WorkspaceService = game:GetService("Workspace")
local DebrisService = game:GetService("Debris")
local ServerStorage = game:GetService("ServerStorage")
local LightingService = game:GetService("Lighting")
local CollectionService = game:GetService("CollectionService")
local UserInputService = game:GetService("UserInputService")
local ServerScriptService = game:GetService("ServerScriptService")
local RunService = game:GetService("RunService")
local PathfindingService = game:GetService("PathfindingService")
local SoundService = game:GetService("SoundService")
local MouseService = game:GetService("MouseService")
local StarterGui = game:GetService("StarterGui")
local BadgeService = game:GetService("BadgeService")
local StarterPlayer = game:GetService("StarterPlayer")
local MarketplaceService = game:GetService("MarketplaceService")
local TeamService = game:GetService("Teams")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local DataStoreService = game:GetService("DataStoreService")
local ChatService = game:GetService("Chat")
local StatService = game:GetService("Stats")
local VisitService = game:GetService("Visit")
local HopperService = game:GetService("Hopper")
local StudioService = game:GetService("Studio")
local GeometryService = game:GetService("Geometry")
local AdvertisementService = game:GetService("AdService")
local SelectionService = game:GetService("Selection")
local VirtualRealityService = game:GetService("VRService")
local GuiService = game:GetService("GuiService")
local LogService = game:GetService("LogService")
local HTTPService = game:GetService("HttpService")
local LuaSettingsService = game:GetService("LuaSettings")
local StarterPack = game:GetService("StarterPack")
local TestService = game:GetService("TestService")
local TextService = game:GetService("TextService")
local UserService = game:GetService("UserService")
local VirtualUserService = game:GetService("VirtualUser")
local AssetService = game:GetService("AssetService")
local GameSettingService = game:GetService("GameSettings")
local GroupService = game:GetService("GroupService")
local LoginService = game:GetService("LoginService")
local TimerService = game:GetService("TimerService")
local DebugSettingService = game:GetService("DebugSettings")
local FriendService = game:GetService("FriendService")
local HapticService = game:GetService("HapticService")
local InsertService = game:GetService("InsertService")
local JointsService = game:GetService("JointsService")
local LuaWebService = game:GetService("LuaWebService")
local NetworkClientService = game:GetService("NetworkClient")
local NetworkServerService = game:GetService("NetworkServer")
local PointsService = game:GetService("PointsService")
local PolicyService = game:GetService("PolicyService")
local ScriptContextService = game:GetService("ScriptContext")
local ScriptService = game:GetService("ScriptService")
local SocialService = game:GetService("SocialService")
local TaskSchedulerService = game:GetService("TaskScheduler")
local BrowserService = game:GetService("BrowserService")
local CookiesService = game:GetService("CookiesService")
local GamepadService = game:GetService("GamepadService")
local PackageService = game:GetService("PackageService")
local PhysicsService = game:GetService("PhysicsService")
local PublishService = game:GetService("PublishService")
local RenderSettingsService = game:GetService("RenderSettings")
local SpawnerService = game:GetService("SpawnerService")
local TextBoxService = game:GetService("TextBoxService")
local ContentProviderService = game:GetService("ContentProvider")
local GamepassService = game:GetService("GamePassService")
local LanguageService = game:GetService("LanguageService")
local KeyboardService = game:GetService("KeyboardService")
local MaterialService = game:GetService("MaterialService")
local NetworkSettingService = game:GetService("NetworkSettings")
local PhysicsSettingService = game:GetService("PhysicsSettings")
local TeleportService = game:GetService("TeleportService")
local TextChatService = game:GetService("TextChatService") 
local AnalyticsService = game:GetService("AnalyticsService")
local FlagStandService = game:GetService("FlagStandService")
local MessagingService = game:GetService("MessagingService")
local UserGameSettingService = game:GetService("UserGameSettings")
local VoiceChatService = game:GetService("VoiceChatService")
local ControllerService = game:GetService("ControllerService")
local HttpRbxApiService = game:GetService("HttpRbxApiService")
local MemoryStorageService = game:GetService("MemStorageService")
local StopWatchReporterService = game:GetService("StopWatchReporter")
local TouchInputService = game:GetService("TouchInputService")
local VisibilityService = game:GetService("VisibilityService")
local VoiceChatInternalService = game:GetService("VoiceChatInternal")
local AssetDeliveryProxyService = game:GetService("AssetDeliveryProxy")
local ClusterPacketCacheService = game:GetService("ClusterPacketCache")
local MemoryStoreService = game:GetService("MemoryStoreService")
local PermissionsService = game:GetService("PermissionsService")
local AvatarEditorService = game:GetService("AvatarEditorService")
local GuidRegistryService = game:GetService("GuidRegistryService")
local ILegacyStudioBridgeService = game:GetService("ILegacyStudioBridge")
local LocalizationService = game:GetService("LocalizationService")
local MeshContentProviderService = game:GetService("MeshContentProvider")
local NotificationService = game:GetService("NotificationService")
local VideoCaptureService = game:GetService("VideoCaptureService")
local VirtualInputManagerService = game:GetService("VirtualInputManager")
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local ContextActionService = game:GetService("ContextActionService")
local RemoteDebuggerServerService = game:GetService("RemoteDebuggerServer")
local RuntimeScriptService = game:GetService("RuntimeScriptService")
local UGCValidationService = game:GetService("UGCValidationService")
local AnimationClipProviderService = game:GetService("AnimationClipProvider")
local ConfigureServerService = game:GetService("ConfigureServerService")
local HSRDataContentProviderService = game:GetService("HSRDataContentProvider")
local ProximityPromptService = game:GetService("ProximityPromptService")
local IncrementalPatchBuilderService = game:GetService("IncrementalPatchBuilder")
local CacheableContentProviderService = game:GetService("CacheableContentProvider")
local HeightmapImporterService = game:GetService("HeightmapImporterService")
local KeyframeSequenceProviderService = game:GetService("KeyframeSequenceProvider")
local SolidModelContentProviderService = game:GetService("SolidModelContentProvider")
local GoogleAnalyticsConfigurationService = game:GetService("GoogleAnalyticsConfiguration")
local ProcessInstancePhysicsService = game:GetService("ProcessInstancePhysicsService")
local FacialAnimationStreamingService = game:GetService("FacialAnimationStreamingService")
local AnimationFromVideoCreatorService = game:GetService("AnimationFromVideoCreatorService")

print("Hello, World.")
5 Likes

Not sure if it’s gonna work but you can put all services in separate module script and the require this single module.

What else can you do lmao. This is scripting in a nutshell.

1 Like

Make module scripts with a certain category of functions. Trying to run the entire game in one script will hurt you more in readability than it will help in performance.

There is a bigger problem if you need all of these services. As @noblemaxx pointed out, you should refactor your code to separate modules!

Also, I’m sure half of these services are CoreScript only. Why did you contrive this?