--// Unified DmgPoint Builder (Fists + Weapon Blade) - FOR YOUR GAME --// K = toggle build/remove --// M = full unload -- ========================= -- ๐Ÿ”ง KEYBINDS -- ========================= local RUN_KEY = Enum.KeyCode.K local UNLOAD_KEY = Enum.KeyCode.M -- ========================= -- ๐Ÿงช DEBUG -- ========================= local DEBUG = true local function dprint(...) if DEBUG then print("[DmgPoints]", ...) end end getgenv().visiblepoints = true -- ========================= -- ๐Ÿ‘Š FIST CUBE SETTINGS -- ========================= local FIST_POINTS_PER_SIDE = 10 -- 5x5 per layer local FIST_IN_LAYER_SPACING = 0.35 -- spacing inside a layer local FIST_LAYER_SPACING = 0.60 -- distance between layers local FIST_LAYER_COUNT = 40 -- number of layers (reach) local FIST_START_FORWARD_OFFSET = 0.50 -- how far from fist the first layer starts -- IMPORTANT: which axis is "pointing" for your fists? -- Try "Look" first; if it goes the wrong way or sideways, try "Right" or "Up". local FIST_FORWARD_AXIS = "Look" -- "Look" | "Right" | "Up" -- Optional: exact fist names. If empty, it auto-detects names containing "punho" local FIST_NAME_WHITELIST = { -- "Punho Direito", -- "Punho Esquerdo", } -- ========================= -- ๐Ÿ—ก๏ธ WEAPON (SWORD/SPEAR) SETTINGS -- ========================= local WEAPON_STEP_DISTANCE = 0.4 local WEAPON_POINT_COUNT = 600 local WEAPON_CLAMP_TO_BLADE = false local WEAPON_FORCE_AXIS = nil -- nil or "X"/"Y"/"Z" local WEAPON_START_MODE = "center" -- "center" or "forward" -- ========================= -- โš™๏ธ SERVICES / RE-EXEC SAFE -- ========================= local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") if getgenv and getgenv().__DMGPOINT_UNIFIED__ and getgenv().__DMGPOINT_UNIFIED__.Unload then pcall(function() getgenv().__DMGPOINT_UNIFIED__.Unload() end) end local lp = Players.LocalPlayer local connections = {} local created = {} local active = false local function disconnectAll() for _, c in ipairs(connections) do pcall(function() c:Disconnect() end) end table.clear(connections) end local function removeCreated() dprint("Removing created attachments:", #created) for _, inst in ipairs(created) do if inst and inst.Parent then pcall(function() inst:Destroy() end) end end table.clear(created) active = false end local function whitelistSet(list) local set = {} for _, name in ipairs(list) do set[name] = true end return set end local FIST_WHITELIST = whitelistSet(FIST_NAME_WHITELIST) -- ========================= -- ๐Ÿ” FIND HIT PARTS -- ========================= local function findWeaponRoot(char) -- Try Character.Weapon first local weapon = char:FindFirstChild("Weapon") if weapon then return weapon end -- Fallback: if you use a Tool, it may be in Backpack/Character for _, child in ipairs(char:GetChildren()) do if child:IsA("Tool") then return child end end return nil end local function findHitPartsContainer(char) local weaponRoot = findWeaponRoot(char) if not weaponRoot then return nil end -- direct child local hp = weaponRoot:FindFirstChild("HitParts") if hp then return hp end -- deep search (debug-friendly, slightly heavier but fine for pressing K) for _, inst in ipairs(weaponRoot:GetDescendants()) do if inst.Name == "HitParts" and inst:IsA("Folder") then return inst end end return nil end local function getWeaponBlade(char) local hitParts = findHitPartsContainer(char) if not hitParts then return nil end return hitParts:FindFirstChild("MainBlade") end local function getFists(char) local hitParts = findHitPartsContainer(char) if not hitParts then return {} end local fists = {} for _, v in ipairs(hitParts:GetChildren()) do if v:IsA("BasePart") then if next(FIST_WHITELIST) ~= nil then if FIST_WHITELIST[v.Name] then table.insert(fists, v) end else if v.Name:lower():find("punho") then table.insert(fists, v) end end end end return fists end -- ========================= -- ๐Ÿ‘Š FIST BUILDER (5x5 cube layers oriented to fist) -- ========================= local function getForwardVector(cf) if FIST_FORWARD_AXIS == "Right" then return cf.RightVector end if FIST_FORWARD_AXIS == "Up" then return cf.UpVector end return cf.LookVector end local function buildFistCube(fistPart) if not fistPart or not fistPart:IsA("BasePart") then return 0 end local cf = fistPart.CFrame local right = cf.RightVector local up = cf.UpVector local forward = getForwardVector(cf) dprint("Fist:", fistPart.Name, "Axis=", FIST_FORWARD_AXIS, "Look=", tostring(cf.LookVector), "Right=", tostring(cf.RightVector), "Up=", tostring(cf.UpVector) ) local n = FIST_POINTS_PER_SIDE local half = (n - 1) / 2 local built = 0 for layer = 0, (FIST_LAYER_COUNT - 1) do local dist = FIST_START_FORWARD_OFFSET + (layer * FIST_LAYER_SPACING) local layerCenterWorld = cf.Position + (forward * dist) for ix = 0, (n - 1) do for iy = 0, (n - 1) do local x = (ix - half) * FIST_IN_LAYER_SPACING local y = (iy - half) * FIST_IN_LAYER_SPACING local worldPos = layerCenterWorld + (right * x) + (up * y) local localPos = cf:PointToObjectSpace(worldPos) local att = Instance.new("Attachment") att.Name = "DmgPoint" att.Visible = (getgenv().visiblepoints == true) att.CFrame = CFrame.new(localPos) att.Parent = fistPart table.insert(created, att) built += 1 end end end return built end -- ========================= -- ๐Ÿ—ก๏ธ WEAPON BUILDER (line) -- ========================= local function pickLongestAxis(size) if size.X >= size.Y and size.X >= size.Z then return "X", size.X * 0.5 elseif size.Y >= size.X and size.Y >= size.Z then return "Y", size.Y * 0.5 else return "Z", size.Z * 0.5 end end local function axisOffset(axis, d) if axis == "X" then return Vector3.new(d, 0, 0) end if axis == "Y" then return Vector3.new(0, d, 0) end return Vector3.new(0, 0, d) end local function buildWeaponPoints(blade) if not blade or not blade:IsA("BasePart") then return 0 end local axis, halfLen = pickLongestAxis(blade.Size) if WEAPON_FORCE_AXIS == "X" or WEAPON_FORCE_AXIS == "Y" or WEAPON_FORCE_AXIS == "Z" then axis = WEAPON_FORCE_AXIS end local startD = (WEAPON_START_MODE == "forward") and 0 or -halfLen local built = 0 dprint("Blade:", blade.Name, "Size=", tostring(blade.Size), "Axis=", axis, "Clamp=", WEAPON_CLAMP_TO_BLADE) for i = 0, WEAPON_POINT_COUNT do local d = startD + (WEAPON_STEP_DISTANCE * i) if WEAPON_CLAMP_TO_BLADE then if d > halfLen + (WEAPON_STEP_DISTANCE * 2) then break end end local att = Instance.new("Attachment") att.Name = "DmgPoint" att.Visible = (getgenv().visiblepoints == true) att.CFrame = CFrame.new(axisOffset(axis, d)) att.Parent = blade table.insert(created, att) built += 1 end return built end -- ========================= -- ๐Ÿš€ TOGGLE RUN -- ========================= local function RUN() local char = lp.Character or lp.CharacterAdded:Wait() dprint("K pressed. active=", active) if active then removeCreated() print("DmgPoints DISABLED") return end local hitParts = findHitPartsContainer(char) dprint("HitParts container:", hitParts and hitParts:GetFullName() or "NOT FOUND") local fists = getFists(char) dprint("Fists found:", #fists) for _, f in ipairs(fists) do dprint(" -", f.Name, f:GetFullName()) end local blade = getWeaponBlade(char) dprint("Blade found:", blade and blade:GetFullName() or "NONE") local fistBuilt = 0 for _, fist in ipairs(fists) do fistBuilt += buildFistCube(fist) end local bladeBuilt = 0 if blade then bladeBuilt = buildWeaponPoints(blade) end if fistBuilt + bladeBuilt == 0 then warn("Built 0 points. Most likely: HitParts not found / names differ / parts not BasePart.") return end active = true print(("DmgPoints ENABLED | fists=%d, blade=%d, total=%d"):format(fistBuilt, bladeBuilt, #created)) end local function UNLOAD() dprint("Unload pressed.") removeCreated() disconnectAll() if getgenv then getgenv().__DMGPOINT_UNIFIED__ = nil end print("Unified DmgPoint runner unloaded") end connections[#connections+1] = UIS.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == UNLOAD_KEY then UNLOAD() return end if input.KeyCode == RUN_KEY then task.spawn(function() local ok, err = pcall(RUN) if not ok then warn("[RUN Error]:", err) end end) end end) if getgenv then getgenv().__DMGPOINT_UNIFIED__ = { Unload = UNLOAD } end dprint("Loaded. Press", RUN_KEY.Name, "to toggle. Press", UNLOAD_KEY.Name, "to unload.")