I'm making a command for HD Admin and I pasted a script I made a while ago and edited a few things and I can't find where my error is.
-- << RETRIEVE FRAMEWORK >> local main = _G.HDAdminMain local settings = main.settings -- << COMMANDS >> local module = { ----------------------------------- { Name = "bubble", Aliases = {}, Prefixes = {settings.Prefix}, Rank = 1, RankLock = false, Loopable = false, Tags = {"fun"}, Description = "Traps you inside a bubble that you can roll around in.", Contributors = {"OwOShiba"}, -- Args = {"Player"}, Function = function(speaker, args) local PhysicsService = game:GetService("PhysicsService") if not args[1] then local player = speaker else local player = args[1] local Players = "Players" local Shield = "Shield" local function weld(x, y) local weld = Instance.new("Weld", x) weld.Part0 = x weld.Part1 = y weld.Parent = x end game.Players.PlayerAdded:Connect( function(player) player.CharacterAdded:Connect( function(character) for _, inst in pairs(character:GetChildren()) do if inst:IsA("BasePart") then PhysicsService:SetPartCollisionGroup(inst, Players) end end end ) local Character = player.Character local Root = Character:WaitForChild("HumanoidRootPart") ------------------------------------------------------------ local part = Instance.new("Part") part.Name = "Bubble" part.Shape = Enum.PartType.Ball part.Transparency = 1 part.Size = Vector3.new(15, 15, 15) PhysicsService:SetPartCollisionGroup(part, Shield) part.Anchored = false part.CFrame = Root.CFrame part.Massless = true --------------------------------------------- local descendants = player.Character:GetDescendants() for _, inst in pairs(descendants) do if inst:IsA("BasePart") and inst.CanCollide then local noCollisionConstraint = Instance.new("NoCollisionConstraint") noCollisionConstraint.Parent = part noCollisionConstraint.Part0 = inst noCollisionConstraint.Part1 = part end end part.Parent = workspace weld(Root, part) end ) end UnFunction = function(speaker, args) if not args[1] then local player = speaker else local player = args[1] local descendants = player.Character:GetDescendants() for _, inst in pairs(descendants) do if inst:IsA("BasePart") and inst.CanCollide and inst.Name.match(inst.Name, "Bubble") then inst.Destroy() end end end end end -- } } return module
The error I get on UnFunction:
W003: Global 'UnFunction' is only used in the enclosing function defined at line 23; consider changing it to local
^Line 23 is
Function = function(speaker, args)