explore
key systems
new
docs
discord
search scripts
⌘K
explore
key systems
new
docs
discord
sign in
⌘↵
--
publishes from anywhere on this page
new paste
untitled.luau
empty
/ 512kb
open file
⌘O
explore
key systems
new
docs
sign in
open-source-mm2-chams-copy.lua
397 lines · 12.7kb
/ 512kb
open file
⌘O
--[[ x4axq mm2 chams (v12) click rows to toggle | X = unload workspace.<username>.Backpack.Toys.Knife -> murderer (red) workspace.<username>.Backpack.Toys.Gun -> sheriff (blue) alive + neither tool (round active) -> innocent (green) ]] local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local LP = Players.LocalPlayer local CFG = { murderer = Color3.fromRGB(255, 48, 48), sheriff = Color3.fromRGB(52, 132, 255), innocent = Color3.fromRGB(61, 220, 116), fill = 0.55, edge = 0.30, scan = 0.18, } local UI = { cardBg = Color3.fromRGB(17, 19, 23), border = Color3.fromRGB(38, 43, 51), divider = Color3.fromRGB(32, 36, 43), textHi = Color3.fromRGB(233, 236, 239), textLo = Color3.fromRGB(174, 180, 188), boxFill = Color3.fromRGB(200, 204, 210), boxOff = Color3.fromRGB(20, 23, 28), boxBorder = Color3.fromRGB(58, 64, 73), close = Color3.fromRGB(120, 126, 134), watermark = Color3.fromRGB(96, 102, 112), } local ROLE_COLOR = { m = CFG.murderer, s = CFG.sheriff, i = CFG.innocent, } local S = { on = false, running = false, includeSelf = false, roles = { migrationBuilder = true }, hl = {}, tag = {}, conns = {}, gui = nil, } -- ── detection ───────────────────────────────────────────── local function checkContainer(container) if not container then return nil end for _, c in ipairs(container:GetChildren()) do if c:IsA("Tool") then if c.Name == "Knife" then return "m" end if c.Name == "Gun" then return "s" end end end return nil end local function findTool(char) local r = checkContainer(char) if r then return r end local back = char:FindFirstChild("Backpack") if not back then return nil end local toys = back:FindFirstChild("Toys") if toys then r = checkContainer(toys) if r then return r end end return checkContainer(back) end local function isAlive(char) if not char then return false end local hum = char:FindFirstChildOfClass("Humanoid") return hum ~= nil and hum.Health > 0 end local function roleOf(plr) local char = plr.Character or workspace:FindFirstChild(plr.Name) if not char or not isAlive(char) then return nil, char end local r = findTool(char) if r then return r, char end local back = plr:FindFirstChild("Backpack") if back then r = checkContainer(back) if r then return r, char end end return nil, char end -- ── highlight ───────────────────────────────────────────── local function drop(plr) local h = S.hl[plr] if h then h:Destroy() end S.hl[plr] = nil S.tag[plr] = nil end local function apply(plr, role, char) local color = ROLE_COLOR[role] if not color then return drop(plr) end local h = S.hl[plr] if not h or h.Adornee ~= char then if h then h:Destroy() end h = Instance.new("Highlight") h.Name = "x4axq" h.Adornee = char h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop h.FillTransparency = CFG.fill h.OutlineTransparency = CFG.edge h.Parent = char S.hl[plr] = h end h.FillColor = color h.OutlineColor = color S.tag[plr] = role end -- ── one pass ────────────────────────────────────────────── local function pass() local roles, chars = {}, {} local active = false for _, plr in ipairs(Players:GetPlayers()) do local role, char = roleOf(plr) chars[plr] = char if role then roles[plr] = role active = true end end if active then for _, plr in ipairs(Players:GetPlayers()) do if not roles[plr] and isAlive(chars[plr]) then roles[plr] = "i" end end end local seen = {} for _, plr in ipairs(Players:GetPlayers()) do local role = roles[plr] local char = chars[plr] if role and char then local allowed = (plr ~= LP) or S.includeSelf if allowed then if role == "m" then allowed = S.roles.murderer elseif role == "s" then allowed = S.roles.sheriff else allowed = S.roles.innocent end end if allowed then seen[plr] = true apply(plr, role, char) end end end local stale = {} for plr in pairs(S.hl) do if not seen[plr] then table.insert(stale, plr) end end for _, plr in ipairs(stale) do drop(plr) end end -- ── loop ────────────────────────────────────────────────── local function clearAll() for plr in pairs(S.hl) do if S.hl[plr] then S.hl[plr]:Destroy() end end S.hl = {} S.tag = {} end local function startLoop() if S.running then return end S.running = true task.spawn(function() while S.running do pass() task.wait(CFG.scan) end end) end local function stopLoop() S.running = false end local function unload() S.on = false S.running = false clearAll() for _, c in ipairs(S.conns) do pcall(function() c:Disconnect() end) end S.conns = {} if S.gui then S.gui:Destroy(); S.gui = nil end pcall(function() getgenv().x4axq_chams = nil end) end -- ── gui ─────────────────────────────────────────────────── local function makeGui() local gui = Instance.new("ScreenGui") gui.Name = "x4axq" gui.ResetOnSpawn = false gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.DisplayOrder = 999 gui.IgnoreGuiInset = false local ok = pcall(function() gui.Parent = (gethui and gethui()) or game:GetService("CoreGui") end) if not ok then gui.Parent = LP:WaitForChild("PlayerGui") end S.gui = gui local card = Instance.new("Frame") card.Size = UDim2.fromOffset(210, 186) card.Position = UDim2.new(0, 16, 0, 72) card.BackgroundColor3 = UI.cardBg card.BorderSizePixel = 0 card.Active = true card.Parent = gui local stroke = Instance.new("UIStroke") stroke.Color = UI.border stroke.Thickness = 1 stroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border stroke.Parent = card local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -40, 0, 30) title.Position = UDim2.fromOffset(12, 0) title.BackgroundTransparency = 1 title.Font = Enum.Font.GothamMedium title.Text = "x4axq mm2 chams" title.TextSize = 12 title.TextColor3 = UI.textHi title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = card local close = Instance.new("TextButton") close.Size = UDim2.fromOffset(22, 22) close.Position = UDim2.new(1, -28, 0, 4) close.BackgroundTransparency = 1 close.Text = "×" close.Font = Enum.Font.Gotham close.TextSize = 15 close.TextColor3 = UI.close close.AutoButtonColor = false close.Parent = card local sep = Instance.new("Frame") sep.Size = UDim2.new(1, -24, 0, 1) sep.Position = UDim2.fromOffset(12, 30) sep.BackgroundColor3 = UI.divider sep.BorderSizePixel = 0 sep.Parent = card local function addRow(y, text, bright) local box = Instance.new("Frame") box.Size = UDim2.fromOffset(10, 10) box.Position = UDim2.fromOffset(14, y + 6) box.BackgroundColor3 = UI.boxOff box.BorderSizePixel = 1 box.BorderColor3 = UI.boxBorder box.Parent = card local label = Instance.new("TextLabel") label.Size = UDim2.new(1, -44, 0, 22) label.Position = UDim2.fromOffset(32, y) label.BackgroundTransparency = 1 label.Font = bright and Enum.Font.GothamMedium or Enum.Font.Gotham label.Text = text label.TextSize = 12 label.TextColor3 = bright and UI.textHi or UI.textLo label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = card local hit = Instance.new("TextButton") hit.Size = UDim2.new(1, -20, 0, 22) hit.Position = UDim2.fromOffset(10, y) hit.BackgroundTransparency = 1 hit.Text = "" hit.AutoButtonColor = false hit.ZIndex = 5 hit.Parent = card return { box = box, hit = hit } end local function paint(row, on) row.box.BackgroundColor3 = on and UI.boxFill or UI.boxOff row.box.BorderColor3 = on and UI.boxFill or UI.boxBorder end local rMaster = addRow(38, "chams", true) local rMurder = addRow(64, "murderer", false) local rSheriff = addRow(90, "sheriff", false) local rInno = addRow(116, "innocent", false) local rSelf = addRow(142, "include self", false) paint(rMurder, S.roles.murderer) paint(rSheriff, S.roles.sheriff) paint(rInno, S.roles.innocent) paint(rSelf, S.includeSelf) local wm = Instance.new("TextLabel") wm.Size = UDim2.fromOffset(90, 10) wm.Position = UDim2.new(1, -102, 1, -14) wm.BackgroundTransparency = 1 wm.Font = Enum.Font.Gotham wm.Text = "x4axq made" wm.TextSize = 9 wm.TextColor3 = UI.watermark wm.TextXAlignment = Enum.TextXAlignment.Right wm.Parent = card local dragStrip = Instance.new("TextButton") dragStrip.Size = UDim2.new(1, -40, 0, 30) dragStrip.Position = UDim2.fromOffset(0, 0) dragStrip.BackgroundTransparency = 1 dragStrip.Text = "" dragStrip.AutoButtonColor = false dragStrip.ZIndex = 6 dragStrip.Parent = card function S.setEnabled(v) if v == S.on then return end S.on = v paint(rMaster, v) if v then startLoop() else stopLoop(); clearAll() end end rMaster.hit.Activated:Connect(function() S.setEnabled(not S.on) end) rMurder.hit.Activated:Connect(function() S.roles.murderer = not S.roles.murderer paint(rMurder, S.roles.murderer) end) rSheriff.hit.Activated:Connect(function() S.roles.sheriff = not S.roles.sheriff paint(rSheriff, S.roles.sheriff) end) rInno.hit.Activated:Connect(function() S.roles.innocent = not S.roles.innocent paint(rInno, S.roles.innocent) end) rSelf.hit.Activated:Connect(function() S.includeSelf = not S.includeSelf paint(rSelf, S.includeSelf) end) close.Activated:Connect(function() unload() end) local dragging, dragStart, origin = false, nil, nil dragStrip.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position origin = card.Position end end) table.insert(S.conns, UIS.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local d = input.Position - dragStart card.Position = UDim2.new(origin.X.Scale, origin.X.Offset + d.X, origin.Y.Scale, origin.Y.Offset + d.Y) end end)) table.insert(S.conns, UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end)) end makeGui() S.setEnabled(true) getgenv().x4axq_chams = { toggle = function() S.setEnabled(not S.on) end, enable = function() S.setEnabled(true) end, disable = function() S.setEnabled(false) end, unload = unload, isOn = function() return S.on end, roles = S.roles, }