I have made a movement module that replaces that Roblox default. It works but really weirdly the jumping is really weird and also the movement feels weird.
The module code is
local MovementClient = {}
MovementClient.__index = MovementClient
local UserInputService = game:GetService("UserInputService")
function Lerp(a, b, t)
return a + (b - a) * t
end
function MovementClient.new(Player, Character)
local newClient = {}
setmetatable(newClient, MovementClient)
newClient.Player = Player
newClient.Character = Character
newClient.MoveVector = Vector3.new(0, 0, 0)
newClient.CameraTurn = 0
-- Disable roblox default movement system
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.BreakJointsOnDeath = false
Humanoid.MaxHealth = 0
Humanoid.Health = 0
Humanoid.WalkSpeed = 0
local Attch = Instance.new("Attachment")
Attch.Name = "MainAttch"
Attch.Parent = Character.HumanoidRootPart
local AlignPosition = Instance.new("AlignPosition")
AlignPosition.Mode = Enum.PositionAlignmentMode.OneAttachment
AlignPosition.Attachment0 = Attch
AlignPosition.Position = Character.HumanoidRootPart.Position
AlignPosition.Parent = Character.HumanoidRootPart
newClient.AlignPosition = AlignPosition
UserInputService.JumpRequest:Connect(function()
if Humanoid.FloorMaterial ~= Enum.Material.Air then
newClient.MoveVector = newClient.MoveVector + Vector3.new(0, 8, 0)
end
end)
return newClient
end
function MovementClient:CalculateCharacterTotalMass()
local totalMass = 0
for i,v in pairs(self.Character:GetDescendants()) do
if not v:IsA("BasePart") then continue end
totalMass += v.Mass
end
return totalMass
end
function MovementClient:Update(deltaTime) -- This function is called on RenderStepped
local Humanoid = self.Character:WaitForChild("Humanoid")
self.MoveVector = Humanoid.MoveDirection
local newPos = self.AlignPosition.Position + self.MoveVector
newPos = Vector3.new(newPos.X, self.Character.HumanoidRootPart.Position.Y / workspace.Gravity, newPos.Z)
self.AlignPosition.Position = newPos
local MouseDelta = UserInputService:GetMouseDelta()
self.CameraTurn = Lerp(self.CameraTurn, math.clamp(MouseDelta.X, -3, 3), (15 * deltaTime))
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0, 0, math.rad(self.CameraTurn))
end
return MovementClient
If anyone could help it would be appreciated