Files
Roblox-Elevator-Game/src/client/Character/Client/SpineKinematics.lua

50 lines
1.0 KiB
Lua

--!optimize 2
--!native
--!strict
local Spine = {
Running = false
}
Spine.__index = Spine
local Storage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Delta = require(Storage:WaitForChild("Delta"))
local Player = Players.LocalPlayer
local CharacterShared = _G.include(script, "CharacterShared")
type CurrentCamera = Camera
type struct_Spine = {
Remote: UnreliableRemoteEvent,
CurrentCamera: CurrentCamera
}
type CharacterSharedFolder = Folder
function Spine.constructor(CurrentCamera: CurrentCamera)
local self = {} :: struct_Spine
self.Remote = CharacterShared:WaitForChild("SpineStream")
self.CurrentCamera = CurrentCamera
return setmetatable(self, Spine)
end
function Spine:Enable()
Spine.Running = true
task.spawn(function()
while Spine.Running do
self.Remote:FireServer(self.CurrentCamera.CFrame, Player.CameraMode == Enum.CameraMode.LockFirstPerson)
Delta:time()
end
end)
end
function Spine:Disable()
Spine.Running = false
Delta:time()
end
return Spine