--!optimize 2 --!native --!strict type UDP = UnreliableRemoteEvent type CharacterSharedFolder = Folder local Players = game:GetService("Players") local Dir = script.Parent local Character = Dir.Parent local preprocessor = {} --Create the character shared directory here local CharacterShared = Instance.new("Folder") CharacterShared.Name = "shared" CharacterShared.Parent = Character function preprocessor.CharacterShared(): Instance return CharacterShared :: CharacterSharedFolder end _G.include = function(this: LuaSourceContainer, FunName: string, ...) --its not extremely necessary to have this security on the server-side 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()) return nil end end local Shadows = require(script:WaitForChild("Shadows")) local SpineModule = require(script:WaitForChild("SpineKinematics")) local FlashlightModule = require(script:WaitForChild("Flashlight")) local ActionsModule = require(script:WaitForChild("Actions")) local Head = Character:WaitForChild("Head") local UpperTorso = Character:WaitForChild("UpperTorso") local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") local LocalPlayer = Players:GetPlayerFromCharacter(Character) local CharacterShadows = Shadows.constructor(Character) local Spine = SpineModule.constructor(Head, UpperTorso) local Flashlight = FlashlightModule.constructor(LocalPlayer, HumanoidRootPart) local Actions = ActionsModule.constructor(LocalPlayer, HumanoidRootPart) local FlashlightDebounce = false CharacterShadows:off() --I plan having 2 player support and characters block a ton of light Character.DescendantAdded:Connect(function(Instance) task.wait() --Wait for the instance to properly replicate? CharacterShadows:PartToggle(Instance, false) end) local FlashlightCooldown = .10 Actions:Add(Enum.KeyCode.F, function(_KeyPressed) if not FlashlightDebounce then Flashlight:Toggle() FlashlightDebounce = true task.wait(FlashlightCooldown) FlashlightDebounce = false end end); Spine.Remote.OnServerEvent:Connect(function(Messenger: Player, CameraPosition: CFrame, IsFirstPerson: boolean) if Messenger.UserId == LocalPlayer.UserId then if SpineModule.Enabled then Spine:Move(CameraPosition, IsFirstPerson) else --reset print("TODO reached -", script.Name..".lua") end else Messenger:Kick(`"{Messenger.Name}", {Messenger.UserId} r="{Spine.Remote.Name}", 1="{tostring(CameraPosition)}", 2="{tostring(IsFirstPerson)}"`) end end) _G.include = nil