
Key Required VerifiedUniversal

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local BASE_SIZE = Vector3.new(10, 10, 10) -- Base to hơn người 5 studs mỗi bên
local EXTRA_LENGTH = 8 -- Dài hơn 4 studs → +8
local MAX_SIZE = Vector3.new(150, 150, 150) -- Nếu nhiều người thì full 150
local trackedTools = {}
local function updateHitboxes()
trackedTools = {}
for _, tool in ipairs(LocalPlayer.Backpack:GetChildren()) do
if tool:IsA("Tool") then
local hitbox = tool:FindFirstChild("Hitbox")
if hitbox and hitbox:IsA("BasePart") then
table.insert(trackedTools, hitbox)
end
end
end
if LocalPlayer.Character then
for _, tool in ipairs(LocalPlayer.Character:GetChildren()) do
if tool:IsA("Tool") then
local hitbox = tool:FindFirstChild("Hitbox")
if hitbox and hitbox:IsA("BasePart") then
table.insert(trackedTools, hitbox)
end
end
end
end
if #trackedTools == 0 then return end
local nearbyPlayers = {}
local myRoot = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
if not myRoot then return end
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= LocalPlayer and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
local dist = (plr.Character.HumanoidRootPart.Position - myRoot.Position).Magnitude
if dist < 50 then
table.insert(nearbyPlayers, plr.Character.HumanoidRootPart)
end
end
end
if #nearbyPlayers > 0 then
local targetPos = myRoot.Position -- default trung bình
local totalPos = Vector3.new()
for _, part in ipairs(nearbyPlayers) do
totalPos += part.Position
end
targetPos = totalPos / #nearbyPlayers
if #nearbyPlayers == 1 then
local direction = (nearbyPlayers[1].Position - myRoot.Position).Unit
targetPos = nearbyPlayers[1].Position + direction * 2 -- offset nhẹ về phía trước
end
local finalSize
if #nearbyPlayers == 1 then
finalSize = BASE_SIZE + Vector3.new(10, 10, EXTRA_LENGTH)
else
finalSize = MAX_SIZE
end
for _, hb in ipairs(trackedTools) do
hb.Size = finalSize
hb.Position = targetPos -- Dời Hitbox tới vị trí trung bình/nhắm
hb.Transparency = 0.7 -- Optional: thấy được để debug
hb.CanCollide = false -- Không cản đường
print("Buff Hitbox: Size = " .. tostring(finalSize) .. " | Pos nhắm = " .. tostring(targetPos))
end
else
for _, hb in ipairs(trackedTools) do
hb.Size = Vector3.new(4, 4, 4)
print("Không có player gần, reset Hitbox size nhỏ")
end
end
end
RunService.Heartbeat:Connect(function()
if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid") and LocalPlayer.Character.Humanoid.Health > 0 then
updateHitboxes()
end
end)
LocalPlayer.Backpack.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
task.wait(0.1)
updateHitboxes()
end
end)
LocalPlayer.CharacterAdded:Connect(function()
task.wait(1)
updateHitboxes()
end)No comments yet for this script.



