I'm looking for a new method to disconnect a function, because the wiki says that the :disconnect()
function is obsolete.
Here is the script I'm working on if anyone can help.
local plr = game.Players.LocalPlayer local M = plr:GetMouse() local fr = script.Parent local T = fr:WaitForChild("TextLabel") function TestFunction() print("Clicked") end M.Move:connect(function() fr.Position = UDim2.new(0, M.X, 0, M.Y) if M.Target ~= nil then if M.Target:IsA("Part") then if M.Target.Parent:FindFirstChild("Base") then fr.Visible = true T.Text = tostring(M.Target.Parent.Name) M.Button1Click:connect(TestFunction()) else fr.Visible = false TestFunction:Disconnect() -- Error is here end end else fr.Visible = false TestFunction:Disconnect() -- Same error here end end)
How could I fix this?