Glitch Tool

Run Settings
LanguageLua
Language Version
Run Command
-- <> Services <> local Players = game:GetService("Players") -- <> Priorities </> local function tweenpriority(func, ...) local tween = game:GetService("TweenService").Create(game:GetService("TweenService"), game, TweenInfo.new(0), {}) local play, thread = tween.Play, ... tween.Completed:Connect(function() func(thread) end) play(tween) end local stall = function(x, func) for i = 1, x do task.desynchronize() task.synchronize() end func() end local function real(func, ...) local returnFunction = function() task.desynchronize() task.synchronize() return true end for i = 1, 1 do repeat task.wait() until returnFunction() == true end func() end local function real2(func, ...) task.spawn(function() while true do task.desynchronize() task.synchronize() task.wait() end end) func() end local function allpriority(func, ...) tweenpriority(function() stall(1, function() real(function() real2(function() task.defer(function() func() end) end) end) end) end) end -- <> Tool local Tool = {} Tool.__index = Tool function Tool.new(parent, name, handle) local self = setmetatable({}, Tool) self.Tool = Instance.new("Tool") self.Handle = handle self.Tool.Parent = parent self.Tool.Name = name self.Handle.Parent = self.Tool self.Handle.Name = "Handle" return self end function Tool:ChangeGrip(cframe) self.Tool.Grip = cframe end function Tool:OnActivate(func) self.Tool.Activated:Connect(func) end -- <> Main Script local playerName = owner.Name or "tabanog1234" -- change this to your username if you want local player = Players:FindFirstChild(playerName) assert(player, playerName .. " not found.") local playerCharacter = player.Character or player.CharacterAdded:Wait() local playerBackpack = player.Backpack local handle = Instance.new("Part") handle.Size = Vector3.new(2.5, 2.5, 2.5) handle.Material = Enum.Material.Neon local highlight = Instance.new("Highlight") highlight.Parent = nil highlight.Adornee = handle highlight.FillTransparency = 0 highlight.DepthMode = Enum.HighlightDepthMode.Occluded local toolName = "Cube" local toolGrip = CFrame.new(0, 0, 1) local myTool = Tool.new(playerBackpack, toolName, handle) myTool:ChangeGrip(toolGrip) local function destroyTouchingParts() local success, error = pcall(function() local area = 5 local excludeTable = { "Baseplate", "Base", "Terrain" } local meshOffset = Vector3.zero for _, part in pairs(Workspace:GetDescendants()) do for _, excludedPart in pairs(excludeTable) do if part.Name ~= excludedPart then if part:IsA("BasePart") then if not part:IsDescendantOf(playerCharacter) then if part:FindFirstChildOfClass("SpecialMesh") then meshOffset = part:FindFirstChildOfClass("SpecialMesh").Offset end local distance = ((handle.Position) - (part.Position + meshOffset)).Magnitude if distance <= area then allpriority(function() task.spawn(function() part.Material = Enum.Material.Neon for i = 1, 10 do local randomColor = Color3.new(math.random(), math.random(), math.random()) part.Color = randomColor task.wait(0.04) end part:Destroy() end) end) end end end end end end end) end myTool:OnActivate(destroyTouchingParts) while task.wait() do local randomColor = Color3.new(math.random(), math.random(), math.random()) handle.Color = randomColor highlight.FillColor = randomColor end
Editor Settings
Theme
Key bindings
Full width
Lines