crouching and move Humanoid.lua from server to client

This commit is contained in:
2023-12-27 14:02:20 -05:00
parent d46b4dc844
commit ecbbc5971a
4 changed files with 55 additions and 7 deletions

View File

@@ -1,5 +1,11 @@
local Storage = game:GetService("ReplicatedStorage")
local ClientStorage = Storage:WaitForChild("Client")
local HumanoidRPSettings = require(script:WaitForChild("HumanoidRootPart"))
local CameraModule = require(script:WaitForChild("Camera"))
local CrouchModule = require(script:WaitForChild("Crouch"))
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
local HumanoidModule = require(script:WaitForChild("Humanoid"))
local Character = script.Parent
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
@@ -8,6 +14,22 @@ local CurrentCamera = workspace.CurrentCamera
local HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart)
local CameraConsturctor = CameraModule.constructor(CurrentCamera, HumanoidRootPart, Humanoid)
local HumanoidSettings = HumanoidModule.constructor(Humanoid)
local function CrouchFeature()
local CrouchConstructor = CrouchModule.constructor(Humanoid)
local CourchBindMap = BindModule.constructor()
CourchBindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
CrouchConstructor:Crouch(10)
end)
CourchBindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
CrouchConstructor:Stand(5)
end)
end
HumanoidSettings:SetWalkSpeed(10)
HRPSettings:DisableRobloxSounds()
CameraConsturctor:EnableBobbing()
CameraConsturctor:EnableBobbing()
CrouchFeature()