big commit

This commit is contained in:
2024-02-08 18:59:42 -05:00
commit 699fe50fea
38 changed files with 2327 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
local CoreGuis = {
AllowReset = false,
AllowEmotes = true,
AllowBackpack = false,
AllowPlayerList = false
}
CoreGuis.__index = CoreGuis
local SG = game:GetService("StarterGui")
local Players = game:GetService("Players")
type CustomCoreGuiEnums = {Enum.CoreGuiType}
local function CustomCoreGuiEnums(): CustomCoreGuiEnums
local CoreElements = Enum.CoreGuiType:GetEnumItems()
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.All))
if CoreGuis.AllowBackpack then
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.Backpack))
end
if CoreGuis.AllowEmotes then
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.EmotesMenu))
end
if CoreGuis.AllowPlayerList then
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.PlayerList))
end
return CoreElements
end
local function ResetEnabled(enabled: boolean)
--Roblox actually doesn't register this fast enough so we gotta resort to cringe tactics
repeat
local PossibleMemoryLeak = pcall(SG.SetCore, SG, "ResetButtonCallback", enabled)
task.wait()
until PossibleMemoryLeak
end
function CoreGuis:On()
local Elements = CustomCoreGuiEnums()
for i = 1, #Elements do
SG:SetCoreGuiEnabled(Elements[i], true)
end
ResetEnabled(CoreGuis.AllowReset)
end
function CoreGuis:Off()
if #Players:GetPlayers()>1 then
--Enable multiplayer features
self:On()
local PlayerAdded --So weird...
PlayerAdded = Players.PlayerAdded:Connect(function(_)
if #Players:GetPlayers()>1 then
self:On()
--We dont need to listen for players anymore
PlayerAdded:Disconnect()
end
end)
else
local Elements = CustomCoreGuiEnums()
for i = 1, #Elements do
SG:SetCoreGuiEnabled(Elements[i], false)
end
end
ResetEnabled(CoreGuis.AllowReset)
end
function CoreGuis:ForceOff()
SG:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
ResetEnabled(false)
end
function CoreGuis:ForceOn()
SG:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
ResetEnabled(true)
end
return CoreGuis

View File

@@ -0,0 +1,8 @@
local GuiModule = {}
GuiModule.__index = GuiModule
local GuiService = game:GetService("GuiService")
return GuiModule

View File

@@ -0,0 +1,13 @@
local Mouse = {}
local UIS = game:GetService("UserInputService")
function Mouse:DisablePointer()
UIS.MouseIconEnabled = false
end
function Mouse:EnablePointer()
UIS.MouseIconEnabled = true
end
return Mouse

View File

@@ -0,0 +1,31 @@
local CrosshairModule = {
Icon = "rbxassetid://12643750723"
}
CrosshairModule.__index = CrosshairModule
--Use a custom crosshair so we can do effects to it
type rbxassetid = string
function CrosshairModule.constructor(PlayerGui: PlayerGui)
local Screen = PlayerGui:WaitForChild("Crosshair")
local Icon = Screen:WaitForChild("ImageLabel")
return setmetatable({
Screen = Screen,
Icon = Icon
}, CrosshairModule)
end
function CrosshairModule:Enable()
self.Screen.Enabled = true
end
function CrosshairModule:Disable()
self.Screen.Enabled = false
end
function CrosshairModule:Change(ID: rbxassetid)
self.Icon.Image = ID or CrosshairModule.Icon
end
return CrosshairModule

View File

@@ -0,0 +1,27 @@
local VignetteModule = {
Enabled = false,
Icon = "rbxassetid://4576475446"
}
VignetteModule.__index = VignetteModule
function VignetteModule.constructor(PlayerGui: PlayerGui)
local Screen = PlayerGui:WaitForChild("Vignette")
local Icon = Screen:WaitForChild("ImageLabel")
return setmetatable({
Screen = Screen,
Icon = Icon
}, VignetteModule)
end
function VignetteModule:Enable()
VignetteModule.Enabled = true
self.Screen.Enabled = true
end
function VignetteModule:Disable()
VignetteModule.Enabled = false
self.Screen.Enabled = false
end
return VignetteModule

View File

@@ -0,0 +1,51 @@
local UI = script:WaitForChild("UI")
local CrosshairSettings = require(UI:WaitForChild("Crosshair"))
local VignetteSettings = require(UI:WaitForChild("Vignette"))
local CoreGuis = require(script:WaitForChild("CoreGuis"))
local Mouse = require(script:WaitForChild("Mouse"))
local Players = game:GetService("Players")
local Storage = game:GetService("ReplicatedStorage")
local ClientStorage = Storage:WaitForChild("Client")
local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete")
local KeyBindsModule = require(ClientStorage:WaitForChild("KeyBinds"))
local CameraSettings = require(ClientStorage:WaitForChild("Camera"))
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
--We need to wait for the game to load before spamming functionality
repeat
local GameIsLoaded = LoadCompleted:Invoke()
task.wait()
until GameIsLoaded
local CurrentCamera = nil
repeat
task.wait()
CurrentCamera = workspace.CurrentCamera
until CurrentCamera
local Vignette = VignetteSettings.constructor(PlayerGui)
local Camera = CameraSettings.constructor(CurrentCamera, Player)
local Crosshair = CrosshairSettings.constructor(PlayerGui)
--Keybinds
local function CameraBinds()
local CameraBindMap = KeyBindsModule.constructor()
CameraBindMap:AddInputBegan({Enum.KeyCode.C, Enum.KeyCode.Z}, function()
Camera:ZoomIn(Vignette, Crosshair)
end)
CameraBindMap:AddInputEnded({Enum.KeyCode.C, Enum.KeyCode.Z}, function()
Camera:ZoomOut(Vignette, Crosshair)
end)
end
CoreGuis:Off()
Camera:FirstPerson()
Mouse:DisablePointer()
Crosshair:Enable()
CameraBinds()