mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
working but roblox bug and fix respawning issues on the client
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2,43 +2,44 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
type UDP = UnreliableRemoteEvent
|
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 = {
|
||||||
__index: Impl_Constructor,
|
__index: Impl_Constructor,
|
||||||
constructor: Constructor_Fun,
|
constructor: Constructor_Fun,
|
||||||
--Class functions
|
--Class functions
|
||||||
EnableSneak: (self: ClassConstructor) -> (),
|
EnableSneak: (self: ClassConstructor) -> (),
|
||||||
DisableSneak: (self: ClassConstructor) -> (),
|
DisableSneak: (self: ClassConstructor) -> (),
|
||||||
EnableCrouch: (self: ClassConstructor) -> (),
|
EnableCrouch: (self: ClassConstructor) -> (),
|
||||||
DisableCrouch: (self: ClassConstructor) -> (),
|
DisableCrouch: (self: ClassConstructor) -> (),
|
||||||
EnableFlashlight: (self: ClassConstructor, FlashlightKey: Enum.KeyCode) -> (),
|
EnableFlashlight: (self: ClassConstructor, FlashlightKey: Enum.KeyCode) -> (),
|
||||||
DisableFlashlight: (self: ClassConstructor, FlashlightKey: Enum.KeyCode) -> (),
|
DisableFlashlight: (self: ClassConstructor, FlashlightKey: Enum.KeyCode) -> (),
|
||||||
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,
|
||||||
Crouching: boolean,
|
Crouching: boolean,
|
||||||
Walk: number,
|
Walk: number,
|
||||||
SneakingSpeed: number,
|
SneakingSpeed: number,
|
||||||
StandHeight: number,
|
StandHeight: number,
|
||||||
CrouchHeight: number,
|
CrouchHeight: number,
|
||||||
WalkSpeedMultiplier: number,
|
WalkSpeedMultiplier: number,
|
||||||
CrouchSpeed: number,
|
CrouchSpeed: number,
|
||||||
FlashlightEnabled: boolean
|
FlashlightEnabled: boolean
|
||||||
}
|
}
|
||||||
type Constructor_Return_Props = {
|
type Constructor_Return_Props = {
|
||||||
Humanoid: Humanoid,
|
Humanoid: Humanoid,
|
||||||
HumanoidSettings: any,
|
HumanoidSettings: any,
|
||||||
CurrentCamera: CurrentCamera,
|
CurrentCamera: CurrentCamera,
|
||||||
ActionsTCP: TCP
|
ActionsTCP: TCP
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ActionsConstructor = ClassConstructor
|
export type ActionsConstructor = ClassConstructor
|
||||||
@@ -61,22 +62,20 @@ 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({
|
||||||
Humanoid = HumanoidSettings.Humanoid,
|
FlashlightRemote = CharacterShared:WaitForChild("Flashlight"),
|
||||||
|
Humanoid = HumanoidSettings.Humanoid,
|
||||||
HumanoidSettings = HumanoidSettings,
|
HumanoidSettings = HumanoidSettings,
|
||||||
CurrentCamera = CurrentCamera,
|
CurrentCamera = CurrentCamera,
|
||||||
ActionsTCP = ActionsTCP
|
ActionsTCP = ActionsTCP
|
||||||
}, Actions)
|
}, Actions)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ local HumanoidModule = require(script:WaitForChild("Humanoid"))
|
|||||||
local SpineModule = require(script:WaitForChild("SpineKinematics"))
|
local SpineModule = require(script:WaitForChild("SpineKinematics"))
|
||||||
local ActionsModule = require(script:WaitForChild("Actions"))
|
local ActionsModule = require(script:WaitForChild("Actions"))
|
||||||
|
|
||||||
type Character = Model
|
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)
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ 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)
|
||||||
local Screen = PlayerGui:WaitForChild("Crosshair") :: ScreenGui
|
local Screen = PlayerGui:WaitForChild("Crosshair") :: ScreenGui
|
||||||
local Icon = Screen:WaitForChild("ImageLabel") :: ImageLabel
|
local Icon = Screen:WaitForChild("ImageLabel") :: ImageLabel
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
Screen = Screen,
|
Screen = Screen,
|
||||||
Icon = Icon
|
Icon = Icon
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -74,8 +71,8 @@ local function CameraBinds()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function Crosshair3DEffect()
|
local function Crosshair3DEffect()
|
||||||
local RootVelocity = Instance.new("BindableEvent") :: BindableEvent
|
local RootVelocity = Instance.new("BindableEvent") :: BindableEvent
|
||||||
RootVelocity.Name = "RootVelocity"
|
RootVelocity.Name = "RootVelocity"
|
||||||
RootVelocity.Parent = ClientStorage
|
RootVelocity.Parent = ClientStorage
|
||||||
|
|
||||||
RootVelocity.Event:Connect(function(RootVelocity: Vector3)
|
RootVelocity.Event:Connect(function(RootVelocity: Vector3)
|
||||||
@@ -91,3 +88,6 @@ HealthSettings:Enable()
|
|||||||
|
|
||||||
CameraBinds()
|
CameraBinds()
|
||||||
Crosshair3DEffect()
|
Crosshair3DEffect()
|
||||||
|
|
||||||
|
LoadCharacter(PlayerCharacter)
|
||||||
|
Player.CharacterAdded:Connect(LoadCharacter)
|
||||||
@@ -8,8 +8,12 @@ type Users = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local Users = {
|
local Users = {
|
||||||
Admin = {},
|
Admin = {
|
||||||
Banned = {}
|
0
|
||||||
|
},
|
||||||
|
Banned = {
|
||||||
|
0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Users
|
return Users
|
||||||
Reference in New Issue
Block a user