mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
97 lines
3.4 KiB
Lua
97 lines
3.4 KiB
Lua
local Character = script.Parent.Parent
|
|
local preprocessor = {}
|
|
|
|
type CharacterSharedFolder = Folder
|
|
|
|
function preprocessor.CharacterShared(): CharacterSharedFolder
|
|
return Character:WaitForChild("shared")
|
|
end
|
|
|
|
_G.include = function(this: LuaSourceContainer, FunName: string, ...)
|
|
if this:IsDescendantOf(script) then --getfenv is being removed
|
|
local switch = preprocessor[FunName]
|
|
return type(switch) == "function" and switch(...) or switch
|
|
else
|
|
warn(`Preprocessor append failed "{FunName}"`, debug.traceback())
|
|
end
|
|
end
|
|
|
|
local Storage = game:GetService("ReplicatedStorage")
|
|
local RS = game:GetService("RunService") :: RunService
|
|
|
|
local ClientStorage = Storage:WaitForChild("Client")
|
|
local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete")
|
|
|
|
--We need to wait for the game to load before spamming functionality
|
|
repeat
|
|
local GameIsLoaded = LoadCompleted:Invoke()
|
|
task.wait()
|
|
until GameIsLoaded
|
|
|
|
local HumanoidRPSettings = require(script:WaitForChild("HumanoidRootPart"))
|
|
local CameraModule = require(script:WaitForChild("Camera"))
|
|
local CrouchModule = require(script:WaitForChild("Crouch"))
|
|
local HumanoidModule = require(script:WaitForChild("Humanoid"))
|
|
local SpineModule = require(script:WaitForChild("SpineKinematics"))
|
|
local FlashlightModule = require(script:WaitForChild("Flashlight"))
|
|
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
|
|
|
|
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
|
|
local Humanoid = Character:WaitForChild("Humanoid")
|
|
local CurrentCamera = workspace.CurrentCamera
|
|
|
|
local HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart)
|
|
local CameraConsturctor = CameraModule.constructor(CurrentCamera, HumanoidRootPart, Humanoid)
|
|
local HumanoidSettings = HumanoidModule.constructor(Humanoid)
|
|
local SpineMovement = SpineModule.constructor(CurrentCamera)
|
|
local Flashlight = FlashlightModule.constructor()
|
|
|
|
local Walking = 10/2 --10 is default
|
|
local ClientBindMap = BindModule.constructor(false)
|
|
|
|
local function ClientCharacterBinds()
|
|
local CrouchConstructor = CrouchModule.constructor(Humanoid)
|
|
--Crouch
|
|
ClientBindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
|
|
CrouchConstructor:Crouch(10)
|
|
end)
|
|
ClientBindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
|
|
CrouchConstructor:Stand(5)
|
|
end)
|
|
--Walk
|
|
ClientBindMap:AddInputBegan({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
|
|
HumanoidSettings:SetWalkSpeed(Walking)
|
|
end)
|
|
ClientBindMap:AddInputEnded({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
|
|
HumanoidSettings:SetWalkSpeed(10)
|
|
end)
|
|
end
|
|
|
|
local function Crosshair3DVelocity_Effect(): RBXScriptSignal
|
|
local RootVelocity = ClientStorage:WaitForChild("RootVelocity") :: BindableEvent
|
|
|
|
local RootVelocitySteps = RS.Heartbeat:ConnectParallel(function(_dt)
|
|
RootVelocity:Fire(HRPSettings:Velocity())
|
|
end)
|
|
return RootVelocitySteps
|
|
end
|
|
|
|
local function FlashlightToggle()
|
|
ClientBindMap:AddInputBegan({Enum.KeyCode.F}, function()
|
|
Flashlight:Toggle()
|
|
end)
|
|
end
|
|
|
|
local function HealthChangeBind()
|
|
|
|
end
|
|
|
|
HumanoidSettings:SetWalkSpeed()
|
|
HumanoidSettings:SetJumpHeight()
|
|
HRPSettings:DisableRobloxSounds()
|
|
CameraConsturctor:EnableBobbing()
|
|
SpineMovement:Enable()
|
|
|
|
ClientCharacterBinds()
|
|
Crosshair3DVelocity_Effect()
|
|
FlashlightToggle() |