can u not make the script a speed bboost just make it like a speed boost but doesnt feel like it but goes as fast as that and also make it that you need to hold s to speed boost if your not holding s and your holding x it doesnt give you any speed boost
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local boostAmount = 260 -- Adjust boost speed
local boostDuration = 0.1 -- Duration of boost in seconds
local boosting = false
local macroEnabled = false
local restrictedItems = {
"[Revolver]",
"[Double-Barrel SG]",
"[TacticalShotgun]",
}
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local function isFirstPerson()
return camera.CameraSubject == humanoid and (camera.Focus.p - camera.CFrame.p).Magnitude < 1
end
local function applyBoost(direction)
if boosting then return end
boosting = true
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = direction * boostAmount
bodyVelocity.MaxForce = Vector3.new(1e5, 0, 1e5)
bodyVelocity.Parent = character:WaitForChild("HumanoidRootPart")
delay(boostDuration, function()
bodyVelocity:Destroy()
boosting = false
end)
end
local function IsRestrictedItem(ItemName)
for _, RestrictedItem in ipairs(restrictedItems) do
if ItemName == RestrictedItem then
return true
end
end
return false
end
local function UnequipRestrictedTools()
if character then
for _, Tool in pairs(character:GetChildren()) do
if Tool:IsA("Tool") and IsRestrictedItem(Tool.Name) then
Tool.Parent = player.Backpack
end
end
end
end
local function applyContinuousBoost()
if isFirstPerson() and macroEnabled and not boosting then
local direction = camera.CFrame.LookVector
applyBoost(direction)
end
end
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.X then
macroEnabled = true
UnequipRestrictedTools()
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.X then
macroEnabled = false
end
end)
RunService.Heartbeat:Connect(function()
if macroEnabled then
player.CameraMinZoomDistance = 0.5
player.CameraMode = Enum.CameraMode.LockFirstPerson
task.wait()
player.CameraMode = Enum.CameraMode.Classic
player.CameraMinZoomDistance = 5
task.wait()
applyContinuousBoost()
else
player.CameraMinZoomDistance = 0.5
player.CameraMode = Enum.CameraMode.Classic
end
end)
end
if player.Character then
onCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(onCharacterAdded)