Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Hitbox Settings
- getgenv().HitboxSize = Vector3.new(20, 20, 20) -- Desired size for the hitboxes
- getgenv().TargetPart = "HumanoidRootPart" -- Part of the character to resize
- getgenv().Enabled = true -- Toggle the script on/off
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- -- Function to modify the hitbox size
- local function updateHitbox(player)
- if getgenv().Enabled and player ~= LocalPlayer and player.Character then
- local targetPart = player.Character:FindFirstChild(getgenv().TargetPart)
- if targetPart and targetPart:IsA("BasePart") then
- targetPart.Size = getgenv().HitboxSize
- targetPart.Transparency = 1 -- Fully invisible
- targetPart.CanCollide = false -- So you can walk through it
- targetPart.Material = Enum.Material.ForceField -- Optional effect
- end
- end
- end
- -- Function to hook character + reapply hitbox constantly
- local function hookPlayer(player)
- local function onCharacterAdded(character)
- -- Wait for the target part and keep updating it every frame
- RunService.RenderStepped:Connect(function()
- if getgenv().Enabled and player ~= LocalPlayer and player.Character then
- local part = player.Character:FindFirstChild(getgenv().TargetPart)
- if part and part:IsA("BasePart") then
- part.Size = getgenv().HitboxSize
- part.Transparency = 1
- part.CanCollide = false
- part.Material = Enum.Material.ForceField
- end
- end
- end)
- end
- player.CharacterAdded:Connect(onCharacterAdded)
- -- If character already exists
- if player.Character then
- onCharacterAdded(player.Character)
- end
- end
- -- Apply to all current players
- for _, player in ipairs(Players:GetPlayers()) do
- hookPlayer(player)
- end
- -- Auto-apply to new players
- Players.PlayerAdded:Connect(function(player)
- hookPlayer(player)
- end)
Add Comment
Please, Sign In to add comment