local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local DEFAULT = 0.7 local state = {density = DEFAULT, strength = 1, press = true} ---------------------------------------------------------------- -- weight ---------------------------------------------------------------- local function props() return PhysicalProperties.new(state.density, 0.3, 0, 1, 1) end local function applyWeight(char) if not char then return end for _, p in ipairs(char:GetDescendants()) do if p:IsA("BasePart") then p.CustomPhysicalProperties = props() end end end local function getMass() local char = player.Character local root = char and char:FindFirstChild("HumanoidRootPart") return root and root.AssemblyMass or 0 end local function hookCharacter(char) task.wait(0.5) applyWeight(char) char.DescendantAdded:Connect(function(p) if p:IsA("BasePart") then p.CustomPhysicalProperties = props() end end) end player.CharacterAdded:Connect(hookCharacter) if player.Character then task.spawn(hookCharacter, player.Character) end ---------------------------------------------------------------- -- press parts below ---------------------------------------------------------------- local rayParams = RaycastParams.new() rayParams.FilterType = Enum.RaycastFilterType.Exclude local cur = {part = nil, attach = nil, force = nil} local function release() if cur.force then cur.force:Destroy() end if cur.attach then cur.attach:Destroy() end cur.part, cur.attach, cur.force = nil, nil, nil end local function isLoose(part) if part.Anchored then return false end local root = part.AssemblyRootPart if root and root.Anchored then return false end if part.Parent and part.Parent:FindFirstChildOfClass("Humanoid") then return false end return true end RunService.Heartbeat:Connect(function() local char = player.Character local root = char and char:FindFirstChild("HumanoidRootPart") local hum = char and char:FindFirstChildOfClass("Humanoid") if not (state.press and root and hum) or hum.FloorMaterial == Enum.Material.Air then release() return end rayParams.FilterDescendantsInstances = {char} local reach = hum.HipHeight + root.Size.Y / 2 + 2 local hit = workspace:Raycast(root.Position, Vector3.new(0, -reach, 0), rayParams) if not (hit and isLoose(hit.Instance)) then release() return end if cur.part ~= hit.Instance then release() local a = Instance.new("Attachment") a.Name = "WeightPress" a.Parent = hit.Instance local f = Instance.new("VectorForce") f.RelativeTo = Enum.ActuatorRelativeTo.World f.ApplyAtCenterOfMass = false f.Attachment0 = a f.Parent = hit.Instance cur.part, cur.attach, cur.force = hit.Instance, a, f end cur.attach.WorldPosition = hit.Position cur.force.Force = Vector3.new(0, -getMass() * workspace.Gravity * state.strength, 0) end) player.CharacterRemoving:Connect(release) ---------------------------------------------------------------- -- gui ---------------------------------------------------------------- local BG = Color3.fromRGB(28, 28, 30) local LINE = Color3.fromRGB(62, 62, 66) local TEXT = Color3.fromRGB(205, 205, 205) local DIM = Color3.fromRGB(125, 125, 130) local ACCENT = Color3.fromRGB(222, 170, 70) local FONT = Enum.Font.Code local gui = Instance.new("ScreenGui") gui.Name = "WeightTool" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local main = Instance.new("Frame") main.Size = UDim2.fromOffset(230, 0) main.AutomaticSize = Enum.AutomaticSize.Y main.Position = UDim2.fromOffset(16, 90) main.BackgroundColor3 = BG main.BorderSizePixel = 0 main.Parent = gui Instance.new("UIStroke", main).Color = LINE local pad = Instance.new("UIPadding", main) pad.PaddingTop, pad.PaddingBottom = UDim.new(0, 8), UDim.new(0, 10) pad.PaddingLeft, pad.PaddingRight = UDim.new(0, 10), UDim.new(0, 10) local list = Instance.new("UIListLayout", main) list.Padding = UDim.new(0, 8) list.SortOrder = Enum.SortOrder.LayoutOrder local function label(parent, str, color, align) local l = Instance.new("TextLabel") l.BackgroundTransparency = 1 l.Size = UDim2.new(1, 0, 0, 16) l.Text = str l.TextColor3 = color or TEXT l.Font = FONT l.TextSize = 13 l.TextXAlignment = align or Enum.TextXAlignment.Left l.Parent = parent return l end local function isPress(i) return i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch end local function isMove(i) return i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch end -- title bar: drag handle + mass readout local bar = Instance.new("Frame") bar.Size = UDim2.new(1, 0, 0, 18) bar.BackgroundTransparency = 1 bar.LayoutOrder = 0 bar.Parent = main label(bar, "weight", DIM) local massLbl = label(bar, "", TEXT, Enum.TextXAlignment.Right) do local dragging, startPos, startMouse bar.InputBegan:Connect(function(i) if isPress(i) then dragging, startPos, startMouse = true, main.Position, i.Position end end) UIS.InputChanged:Connect(function(i) if dragging and isMove(i) then local d = i.Position - startMouse main.Position = UDim2.fromOffset(startPos.X.Offset + d.X, startPos.Y.Offset + d.Y) end end) UIS.InputEnded:Connect(function(i) if isPress(i) then dragging = false end end) end local function divider(order) local f = Instance.new("Frame") f.Size = UDim2.new(1, 0, 0, 1) f.BackgroundColor3 = LINE f.BorderSizePixel = 0 f.LayoutOrder = order f.Parent = main end -- log-scale slider local function makeSlider(order, name, min, max, init, fmt, commit) local holder = Instance.new("Frame") holder.Size = UDim2.new(1, 0, 0, 34) holder.BackgroundTransparency = 1 holder.LayoutOrder = order holder.Parent = main label(holder, name, DIM) local valLbl = label(holder, "", TEXT, Enum.TextXAlignment.Right) local hit = Instance.new("TextButton") hit.Text = "" hit.AutoButtonColor = false hit.BackgroundTransparency = 1 hit.Position = UDim2.fromOffset(0, 18) hit.Size = UDim2.new(1, 0, 0, 16) hit.Parent = holder local track = Instance.new("Frame") track.AnchorPoint = Vector2.new(0, 0.5) track.Position = UDim2.fromScale(0, 0.5) track.Size = UDim2.new(1, 0, 0, 2) track.BackgroundColor3 = LINE track.BorderSizePixel = 0 track.Parent = hit local fill = Instance.new("Frame") fill.BackgroundColor3 = ACCENT fill.BorderSizePixel = 0 fill.Parent = track local knob = Instance.new("Frame") knob.AnchorPoint = Vector2.new(0.5, 0.5) knob.Size = UDim2.fromOffset(6, 14) knob.BackgroundColor3 = TEXT knob.BorderSizePixel = 0 knob.Parent = hit local value = init local function show() local t = math.log(value / min) / math.log(max / min) fill.Size = UDim2.fromScale(t, 1) knob.Position = UDim2.new(t, 0, 0.5, 0) valLbl.Text = fmt(value) end show() local dragging = false local function fromX(x) local t = math.clamp((x - hit.AbsolutePosition.X) / hit.AbsoluteSize.X, 0, 1) value = math.floor(min * (max / min) ^ t * 100 + 0.5) / 100 value = math.clamp(value, min, max) show() end hit.InputBegan:Connect(function(i) if isPress(i) then dragging = true fromX(i.Position.X) end end) UIS.InputChanged:Connect(function(i) if dragging and isMove(i) then fromX(i.Position.X) end end) UIS.InputEnded:Connect(function(i) if dragging and isPress(i) then dragging = false commit(value) end end) return { set = function(v) value = math.clamp(v, min, max) show() commit(value) end, } end local function flatButton(order, str, cb) local b = Instance.new("TextButton") b.Size = UDim2.new(1, 0, 0, 24) b.BackgroundColor3 = BG b.AutoButtonColor = false b.BorderSizePixel = 0 b.Text = str b.TextColor3 = TEXT b.Font = FONT b.TextSize = 13 b.LayoutOrder = order b.Parent = main local s = Instance.new("UIStroke", b) s.Color = LINE b.MouseEnter:Connect(function() s.Color = DIM end) b.MouseLeave:Connect(function() s.Color = LINE end) b.Activated:Connect(cb) return b end -- density slider + exact value box local densitySlider = makeSlider(1, "density", 0.01, 100, DEFAULT, function(v) return string.format("%.2f", v) end, function(v) state.density = v applyWeight(player.Character) end) local box = Instance.new("TextBox") box.Size = UDim2.new(1, 0, 0, 24) box.BackgroundColor3 = BG box.BorderSizePixel = 0 box.Text = "" box.PlaceholderText = "exact value, enter to apply" box.PlaceholderColor3 = DIM box.TextColor3 = TEXT box.Font = FONT box.TextSize = 13 box.ClearTextOnFocus = true box.LayoutOrder = 2 box.Parent = main Instance.new("UIStroke", box).Color = LINE box.FocusLost:Connect(function() local n = tonumber(box.Text) if n then densitySlider.set(n) end box.Text = "" end) divider(3) -- press toggle + strength local pressBtn local function refreshPress() pressBtn.Text = (state.press and "[x]" or "[ ]") .. " press parts below" end pressBtn = flatButton(4, "", function() state.press = not state.press refreshPress() end) refreshPress() makeSlider(5, "press strength", 1, 500, 1, function(v) return "x" .. string.format("%.1f", v) end, function(v) state.strength = v end) divider(6) flatButton(7, "reset", function() densitySlider.set(DEFAULT) end) -- live mass readout RunService.RenderStepped:Connect(function() massLbl.Text = "mass " .. string.format("%.1f", getMass()) end) UIS.InputBegan:Connect(function(input, processed) if not processed and input.KeyCode == Enum.KeyCode.RightShift then main.Visible = not main.Visible end end)