Heya, how would I patch this script within my game? I’d like some help if that’s alright.
This is a Vehicle-Fly Exploit
local Speed = 50
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character
local HRP = Character:WaitForChild("HumanoidRootPart")
local Camera = workspace.CurrentCamera
local BodyVelocity = Instance.new("BodyVelocity", HRP)
BodyVelocity.Velocity = Vector3.new(0, 0, 0)
BodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
local BodyGyro = Instance.new("BodyGyro", HRP)
BodyGyro.P = 9e4
BodyGyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
RunService.RenderStepped:Connect(function()
local MoveX = 0
local MoveY = 0
local MoveZ = 0
if UIS:IsKeyDown(Enum.KeyCode.W) then
MoveZ = -10
end
if UIS:IsKeyDown(Enum.KeyCode.S) then
MoveZ = 10
end
if UIS:IsKeyDown(Enum.KeyCode.A) then
MoveX = -10
end
if UIS:IsKeyDown(Enum.KeyCode.D) then
MoveX = 10
end
if UIS:IsKeyDown(Enum.KeyCode.W) or UIS:IsKeyDown(Enum.KeyCode.A) or UIS:IsKeyDown(Enum.KeyCode.S) or UIS:IsKeyDown(Enum.KeyCode.D) then
BodyVelocity.Velocity = CFrame.new(HRP.Position, (HRP.CFrame * CFrame.new(MoveX, MoveY, MoveZ).Position)).LookVector * Speed
else
BodyVelocity.Velocity = Vector3.new(0, 0, 0)
end
BodyGyro.CFrame = Camera.CoordinateFrame
end)```
I recommend you should make a rubber banding anti cheat. or just detect a BodyGyro inside of the players character model
Example: dont actually use this
local plr = game.Players.LocalPlayer
local character = plr.Character
for i,gyro in pairs(character:GetDescendants()) do
if gyro:IsA("BodyGyro", "BodyVelocity") then
plr:LoadCharacter() -- for false positive prevention
end
end
this was wrote without being in studio so idk if this is correct.
You could, as a temporary fix, remove network ownership of the humanoidrootpart from the player.
--When player gets into vehicle
Character.HumanoidRootPart:SetNetworkOwner(nil)
--When player gets out of vehicle
Character.HumanoidRootPart:SetNetworkOwner(Player)
My anti cheat detects fly, cframefly, vehiclefly. vehicle fly does kinda work over it but after like 10 seconds it forces u to get out the vehicle and rubber bands you
That’s not bad idea, but Roblox servers often run on high latency, and making the vehicle which is player controlled server-side could result in some lags and bad gameplay experience for the player.
Just adding in case the person didn’t know consequences of such solution.
This is an easy function (On Client) so exploit can delete it but it works!
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
repeat task.wait() until player.Character.Parent
character.HumanoidRootPart.ChildAdded:Connect(function(Obj)
if Obj:IsA("BodyGyro", "BodyVelocity") then
player:Kick("Stop Exploiting")
end
end)