RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Write a system for a Euphoria movement system"
Yes, you can fix this by setting a maximum speed value and ensuring the newSpeed value does not exceed this limit. Here's the updated FluidMovement function with a maxSpeed value: ```lua function EuphoriaModule:FluidMovement(character, deltaTime) if not deltaTime then return end local humanoid = character.Humanoid local rootPart = character.HumanoidRootPart local targetSpeed = humanoid.WalkSpeed local currentSpeed = rootPart.Velocity.Magnitude local maxSpeed = 50 -- Set the maximum speed value if humanoid:GetState() == Enum.HumanoidStateType.Running then targetSpeed = targetSpeed * 1.5 end local newSpeed = lerp(currentSpeed, targetSpeed, deltaTime * 5) newSpeed = math.clamp(newSpeed, 0, maxSpeed) -- Clamp the newSpeed value within a specific range humanoid.WalkSpeed = newSpeed local moveDirection = humanoid.MoveDirection if moveDirection.Magnitude > 0 then moveDirection = moveDirection.Unit -- Normalize the moveDirection vector local targetCFrame = CFrame.new(rootPart.Position, rootPart.Position moveDirection) rootPart.CFrame = rootPart.CFrame:Lerp(targetCFrame, deltaTime * 5) end end ``` In this example, the maxSpeed value is set to 50. You can adjust this value to control the maximum speed the player can reach. The newSpeed value is clamped between 0 and maxSpeed, ensuring the player's speed does not exceed the limit.