can u fix this macro please so when i go on walls i keep like stuck in walls can you fix it for me
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local boostAmount = 260
local boostDuration = 0.1
local holdingBack = false
local holdingMacro = false
local boosting = false
local lastGroundedDirection = nil
local restrictedItems = {
"[Revolver]",
"[Double-Barrel SG]",
"[TacticalShotgun]",
}
local function IsRestrictedItem(itemName)
for _, restricted in ipairs(restrictedItems) do
if itemName == restricted then
return true
end
end
return false
end
local function UnequipRestrictedTools()
local character = LocalPlayer.Character
if character then
for _, tool in pairs(character:GetChildren()) do
if tool:IsA("Tool") and IsRestrictedItem(tool.Name) then
tool.Parent = LocalPlayer.Backpack
end
end
end
end
local function ApplyBoostRampUp(boostDirection)
if boosting then return end
boosting = true
local character = LocalPlayer.Character
if not character then return end
local rootPart = character:FindFirstChild("HumanoidRootPart")
if not rootPart then return end
-- Horizontal direction only (remove vertical)
local horizontalDirection = Vector3.new(boostDirection.X, 0, boostDirection.Z)
if horizontalDirection.Magnitude == 0 then
horizontalDirection = Vector3.new(0, 0, 1)
else
horizontalDirection = horizontalDirection.Unit
end
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1e5, 0, 1e5)
bodyVelocity.Parent = rootPart
local rampSteps = {
{speed = boostAmount * 0.4, duration = 0.04},
{speed = boostAmount * 0.7, duration = 0.03},
{speed = boostAmount, duration = boostDuration - 0.07}
}
spawn(function()
for _, step in ipairs(rampSteps) do
bodyVelocity.Velocity = horizontalDirection * step.speed
task.wait(step.duration)
end
bodyVelocity:Destroy()
boosting = false
end)
end
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.DPadDown then
holdingBack = true
elseif input.KeyCode == Enum.KeyCode.X or input.KeyCode == Enum.KeyCode.DPadLeft then
holdingMacro = true
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.DPadDown then
holdingBack = false
elseif input.KeyCode == Enum.KeyCode.X or input.KeyCode == Enum.KeyCode.DPadLeft then
holdingMacro = false
end
end)
local function IsOnGround(humanoid)
local state = humanoid:GetState()
return state ~= Enum.HumanoidStateType.Freefall and state ~= Enum.HumanoidStateType.Jumping
end
RunService.Heartbeat:Connect(function()
local character = LocalPlayer.Character
if not character then return end
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
local rootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoid or not rootPart then return end
local isGrounded = IsOnGround(humanoid)
if holdingBack and holdingMacro then
if isGrounded then
lastGroundedDirection = Camera.CFrame.LookVector
end
LocalPlayer.CameraMinZoomDistance = 0.5
LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
task.wait()
LocalPlayer.CameraMode = Enum.CameraMode.Classic
LocalPlayer.CameraMinZoomDistance = 5
task.wait()
UnequipRestrictedTools()
local boostDirection = isGrounded and Camera.CFrame.LookVector or lastGroundedDirection or Camera.CFrame.LookVector
ApplyBoostRampUp(boostDirection)
else
LocalPlayer.CameraMinZoomDistance = 0.5
LocalPlayer.CameraMode = Enum.CameraMode.Classic
end
end)