I’m having issues where people with FPS unlockers are able to go faster in a boat. I don’t want to disable or force players who are using these to turn them off, but how I can prevent it from causing issues with this particular render stepped and still run smoothly for users in 60fps.
function BoatController:UpdateMovement()
local MoveVector = self.ControlModule:GetMoveVector() -- Player controls
script.Inputs.Forward.Value = MoveVector.Z <= -0.2 -- Forward -> -1 Y
script.Inputs.Backward.Value = MoveVector.Z >= 0.2 -- Backward -> 1 Y
script.Inputs.Right.Value = MoveVector.X >= 0.2 -- Right -> 1 X
script.Inputs.Left.Value = MoveVector.X <= -0.2 -- Left -> -1 X
if self.CurrentBoat then
local NewDriveVector = Vector3.new(
0,
0,
math.clamp(script.ForwardAmount.Value * script.SlowdownPercent.Value, -1, 1)
)
local BoatBaseCFrame = self.CurrentBoat.CFrame
local TrueDirectionVector = BoatBaseCFrame:VectorToWorldSpace(NewDriveVector)
local HorizontalVector = TrueDirectionVector * Vector3.new(1, 0, 1)
local Speed = self.BoatMaxSpeed
if CacheController.Data.ActiveBoosts["Speed"] then
Speed *= 2
end
if CacheController.Data.PowerUps["Speed"] then
Speed *= 2
end
self.BodyVelocity.Velocity = HorizontalVector * Speed
local Multiplier = math.sign(NewDriveVector.Z)
self.BodyGyro.CFrame = self.BodyGyro.CFrame * CFrame.Angles(0, math.rad((self.Turn / 10) * Vector3.new(0, 0, NewDriveVector.Z).Magnitude * Multiplier), 0)
-- Boat rocking
local BoatSpeed = self.CurrentBoat.AssemblyLinearVelocity.Magnitude / 10
local SlowdownPercent = script.SlowdownPercent.Value
SlowdownPercent = math.clamp(1 - SlowdownPercent - .5, 0, 1)
self.CurrentBoat.RootPart.CFrame = self.CurrentBoat.CFrame * self.RootOffset
* CFrame.Angles(math.rad(math.sin(tick() * self.RockSpeed + (self.RockSpeed * SlowdownPercent) ) * self.RockMagnitude * SlowdownPercent * BoatSpeed),
0,
math.rad(math.sin(tick() * self.RockSpeed + (self.RockSpeed * SlowdownPercent) * 2) * self.RockMagnitude * SlowdownPercent * BoatSpeed))
end
end
--// Update movement
RunService.Heartbeat:Connect(function()
self:UpdateMovement()
end)