working but roblox bug and fix respawning issues on the client

This commit is contained in:
2024-04-22 20:12:48 -04:00
parent 431ec165b8
commit cb0d1d44dc
6 changed files with 56 additions and 51 deletions

File diff suppressed because one or more lines are too long

View File

@@ -6,6 +6,7 @@ type UDP = UnreliableRemoteEvent
type TCP = RemoteEvent
type inherented = any
type CurrentCamera = Camera
type CharacterShared = Folder
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = {
@@ -21,7 +22,7 @@ type Impl_Constructor = {
ToggleFlashlight: (self: ClassConstructor, FlashlightKey: Enum.KeyCode) -> ()
} & Impl_Static_Props
type Constructor_Fun = (HumanoidSettings: inherented, CurrentCamera: CurrentCamera, ActionsTCP: TCP) -> ClassConstructor
type Constructor_Fun = (CharacterShared: CharacterShared, HumanoidSettings: inherented, CurrentCamera: CurrentCamera, ActionsTCP: TCP) -> ClassConstructor
type Impl_Static_Props = {
DoingAction: boolean,
Sneaking: boolean,
@@ -61,18 +62,16 @@ Actions.CrouchSpeed = .2
--Flashlight static properties
Actions.FlashlightEnabled = false
local CharacterShared = _G.include(script, "CharacterShared")
local FlashlightRemote: UDP = CharacterShared:WaitForChild("Flashlight")
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
local Storage = game:GetService("ReplicatedStorage")
local Tween = require(Storage:WaitForChild("Tween"))
local Delta = require(Storage:WaitForChild("Delta"))
local CrouchTween = Tween.constructor()
function Actions.constructor(HumanoidSettings: inherented, CurrentCamera: CurrentCamera, ActionsTCP: TCP)
function Actions.constructor(CharacterShared, HumanoidSettings, CurrentCamera, ActionsTCP)
return setmetatable({
FlashlightRemote = CharacterShared:WaitForChild("Flashlight"),
Humanoid = HumanoidSettings.Humanoid,
HumanoidSettings = HumanoidSettings,
CurrentCamera = CurrentCamera,
@@ -128,7 +127,7 @@ function Actions:EnableFlashlight(FlashlightKey)
local c = table.pack(self.CurrentCamera.CFrame:ToEulerAnglesXYZ())
table.insert(c, c.n)
FlashlightRemote:FireServer(c)
self.FlashlightRemote:FireServer(c)
Delta:time()
end
end)

View File

@@ -18,6 +18,7 @@ type Character = Model
type HumanoidRootPart = BasePart
type TCP = RemoteEvent
type CurrentCamera = Camera
type CharacterShared = Folder
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = {
@@ -43,6 +44,7 @@ type Impl_Static_Props = {
type Constructor_Fun = (Character: Character) -> ClassConstructor
type Constructor_Return_Props = {
CharacterShared: CharacterShared,
ActionsTCP: TCP,
CurrentCamera: CurrentCamera,
HRPSettings: HumanoidRPSettings.HumanoidRPSettingsConstructor,
@@ -71,17 +73,17 @@ CharacterModule.KeyBinds = {
}
function CharacterModule.constructor(Character)
local CharacterShared = Character:WaitForChild("shared") :: Folder
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") :: HumanoidRootPart
local Humanoid = Character:WaitForChild("Humanoid") :: Humanoid
local self = {} :: Constructor_Return_Props
self.CharacterShared = Character:WaitForChild("shared") :: Folder
self.CurrentCamera = workspace.CurrentCamera
self.ActionsTCP = CharacterShared:WaitForChild("Actions") :: TCP
self.ActionsTCP = self.CharacterShared:WaitForChild("Actions") :: TCP
self.HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart)
self.CameraConsturctor = CameraModule.constructor(self.CurrentCamera, HumanoidRootPart, Humanoid)
self.HumanoidSettings = HumanoidModule.constructor(Humanoid)
self.SpineMovement = SpineModule.constructor(CharacterShared, self.CurrentCamera)
self.SpineMovement = SpineModule.constructor(self.CharacterShared, self.CurrentCamera)
pcall(table.clear, _G)
pcall(table.freeze, _G)
@@ -93,7 +95,7 @@ end
function CharacterModule:CharacterKeyBinds()
local ClientBindMap = BindModule.constructor(false)
local Actions = ActionsModule.constructor(self.HumanoidSettings, self.CurrentCamera, self.ActionsTCP)
local Actions = ActionsModule.constructor(self.CharacterShared, self.HumanoidSettings, self.CurrentCamera, self.ActionsTCP)
--Crouch
ClientBindMap:AddInputBegan(CharacterModule.KeyBinds.Crouch, function(_KeyPressed)

View File

@@ -30,7 +30,7 @@ CrosshairModule.__index = CrosshairModule
--Use a custom crosshair so we can do effects to it
CrosshairModule.Icon = "rbxassetid://12643750723"
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
local Storage = game:GetService("ReplicatedStorage")
local Easings = require(Storage:WaitForChild("Algebra"))
function CrosshairModule.constructor(PlayerGui: PlayerGui)

View File

@@ -9,10 +9,10 @@ local Storage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService")
--Production--
--if not RS:IsStudio() then
RS.RenderStepped:Wait()
if not RS:IsStudio() then
task.wait(.5)
script.Parent.Parent = nil
--end
end
--
local UI = script:WaitForChild("UI")
@@ -58,9 +58,6 @@ local Vignette = VignetteSettings.constructor(PlayerGui)
local Camera = CameraSettings.constructor(CurrentCamera, Player)
local Crosshair = CrosshairSettings.constructor(PlayerGui)
LoadCharacter(PlayerCharacter)
Player.CharacterAdded:Connect(LoadCharacter)
--Keybinds
local function CameraBinds()
local CameraBindMap = KeyBindsModule.constructor(false)
@@ -91,3 +88,6 @@ HealthSettings:Enable()
CameraBinds()
Crosshair3DEffect()
LoadCharacter(PlayerCharacter)
Player.CharacterAdded:Connect(LoadCharacter)

View File

@@ -8,8 +8,12 @@ type Users = {
}
local Users = {
Admin = {},
Banned = {}
Admin = {
0
},
Banned = {
0
}
}
return Users