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

View File

@@ -18,6 +18,7 @@ type Character = Model
type HumanoidRootPart = BasePart type HumanoidRootPart = BasePart
type TCP = RemoteEvent type TCP = RemoteEvent
type CurrentCamera = Camera type CurrentCamera = Camera
type CharacterShared = Folder
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = { type Impl_Constructor = {
@@ -43,6 +44,7 @@ type Impl_Static_Props = {
type Constructor_Fun = (Character: Character) -> ClassConstructor type Constructor_Fun = (Character: Character) -> ClassConstructor
type Constructor_Return_Props = { type Constructor_Return_Props = {
CharacterShared: CharacterShared,
ActionsTCP: TCP, ActionsTCP: TCP,
CurrentCamera: CurrentCamera, CurrentCamera: CurrentCamera,
HRPSettings: HumanoidRPSettings.HumanoidRPSettingsConstructor, HRPSettings: HumanoidRPSettings.HumanoidRPSettingsConstructor,
@@ -71,17 +73,17 @@ CharacterModule.KeyBinds = {
} }
function CharacterModule.constructor(Character) function CharacterModule.constructor(Character)
local CharacterShared = Character:WaitForChild("shared") :: Folder
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") :: HumanoidRootPart local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") :: HumanoidRootPart
local Humanoid = Character:WaitForChild("Humanoid") :: Humanoid local Humanoid = Character:WaitForChild("Humanoid") :: Humanoid
local self = {} :: Constructor_Return_Props local self = {} :: Constructor_Return_Props
self.CharacterShared = Character:WaitForChild("shared") :: Folder
self.CurrentCamera = workspace.CurrentCamera self.CurrentCamera = workspace.CurrentCamera
self.ActionsTCP = CharacterShared:WaitForChild("Actions") :: TCP self.ActionsTCP = self.CharacterShared:WaitForChild("Actions") :: TCP
self.HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart) self.HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart)
self.CameraConsturctor = CameraModule.constructor(self.CurrentCamera, HumanoidRootPart, Humanoid) self.CameraConsturctor = CameraModule.constructor(self.CurrentCamera, HumanoidRootPart, Humanoid)
self.HumanoidSettings = HumanoidModule.constructor(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.clear, _G)
pcall(table.freeze, _G) pcall(table.freeze, _G)
@@ -93,7 +95,7 @@ end
function CharacterModule:CharacterKeyBinds() function CharacterModule:CharacterKeyBinds()
local ClientBindMap = BindModule.constructor(false) 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 --Crouch
ClientBindMap:AddInputBegan(CharacterModule.KeyBinds.Crouch, function(_KeyPressed) 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 --Use a custom crosshair so we can do effects to it
CrosshairModule.Icon = "rbxassetid://12643750723" CrosshairModule.Icon = "rbxassetid://12643750723"
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local Easings = require(Storage:WaitForChild("Algebra")) local Easings = require(Storage:WaitForChild("Algebra"))
function CrosshairModule.constructor(PlayerGui: PlayerGui) function CrosshairModule.constructor(PlayerGui: PlayerGui)

View File

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

View File

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