Slider Module: Attempt to get signal::Destroy (not a valid member) error when I try destroying it

I am making a slider system using this module. Everything works perfectly fine, but whenever I try destroying the slider it gives this error:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Event = Remotes:WaitForChild("SynthGui")
local Slider = require(ReplicatedStorage:WaitForChild("Slider"))

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")

local started = false

local gui = script.Synthesizer
local frame = gui:WaitForChild("Frame")

local instrumentDropdown = frame:WaitForChild("DropdownInstrument")
local topbar = frame:WaitForChild("Topbar")
local topbarItems = topbar:WaitForChild("Items")

local BPM_Option = topbarItems:WaitForChild("2BPM")
local BPM_TextBox = BPM_Option:WaitForChild("TextBox")
local Instrument_Option = topbarItems:WaitForChild("3Instrument")
local Instrument_Button = Instrument_Option:WaitForChild("Dropdown")
local TrackVolume_Option = topbarItems:WaitForChild("9_0TrackVolume")
local TrackVolume_SliderHolder = TrackVolume_Option:WaitForChild("SliderHolder")
local TrackVolume_Slider
local TrackNumber_Option = topbarItems:WaitForChild("9_1Track")
local TrackNumber_Label = TrackNumber_Option:WaitForChild("TextLabel")
local TrackNumber_RightButton = TrackNumber_Option:WaitForChild("Right")
local TrackNumber_LeftButton = TrackNumber_Option:WaitForChild("Left")
local PlayButton = topbarItems:WaitForChild("0Play")
local DrawButton = topbarItems:WaitForChild("4Draw")
local SelectButton = topbarItems:WaitForChild("5Select")
local EraseButton = topbarItems:WaitForChild("6Erase")
local CopyButton = topbarItems:WaitForChild("7Copy")
local PasteButton = topbarItems:WaitForChild("8Paste")
local SelectAllButton = topbarItems:WaitForChild("9SelectAll")
local ExitButton = topbarItems:WaitForChild("9_3Exit")

local toggleButtons = {
	DrawButton,
	SelectButton,
	EraseButton
}

local scrollingFrame = frame:WaitForChild("ScrollingFrame")

local MAX_BPM = 999
local MIN_BPM = 1

local currentTrack = 1

local conns = {}

local ToggleableButtons = {
	Erase = false,
	Select = false,
	Draw = true
}

local function newTrack()
	return {
		Track = 1,
		Instrument = "Piano",
		BPM = 110,
		Volume = 100,
		Playing = false
	}
end

local TrackData = {
	[1] = { Name = "Track 1", Data = newTrack() },
	[2] = { Name = "Track 2", Data = newTrack() },
	[3] = { Name = "Track 3", Data = newTrack() },
	[4] = { Name = "Track 4", Data = newTrack() }
}

local module = {}

local function ToggleButton(button, dataEntry, reset)
	if not button and not reset then
		return
	end
	
	local function resetAll()
		for _, e in pairs(ToggleableButtons) do
			e = false
		end
		for _, b in pairs(toggleButtons) do
			local image = (b.ImageTransparency == 1 and b:FindFirstChildWhichIsA("ImageLabel")) or b
			image.ImageTransparency = 0.3
		end
	end
	
	resetAll()
	
	if reset then return end
	if not button:IsA("ImageButton") then return end
	
	dataEntry = not dataEntry
	
	local image
	if button.ImageTransparency == 1 then
		image = button:FindFirstChildWhichIsA("ImageLabel")
	else
		image = button
	end
	image.ImageTransparency = (dataEntry and 0) or 0.3
end

local function setLabels(reset: boolean)
	local data = TrackData[currentTrack]
	if not data then return end
	
	if reset then
		ToggleButton(nil, nil, true)
		return
	end
	
	BPM_TextBox.Text = tostring(data.Data.BPM)
	TrackNumber_Label.Text = tostring(currentTrack)
end

local function InitSlider()
	local data = TrackData[currentTrack]
	if not data then return end
	
	if TrackVolume_Slider then
		TrackVolume_Slider:Destroy()
		TrackVolume_Slider = nil
	end
	
	TrackVolume_Slider = Slider.new(TrackVolume_SliderHolder, {
		SliderData = {Start = 0, End = 100, Increment = 0.1},
		MoveInfo = TweenInfo.new(0.1, Enum.EasingStyle.Quad)
	})
	
	TrackVolume_Slider:OverrideValue(data.Data.Volume)
	
	TrackVolume_Slider:Track()
	
	conns["Volume_Slider"] = TrackVolume_Slider.Released:Connect(function(value: Number)
		data.Data.Volume = value
	end)
end

local function buttonConns()
	conns[DrawButton.Name] = DrawButton.MouseButton1Click:Connect(function()
		ToggleButton(DrawButton, ToggleableButtons.Erase)
	end)

	conns[SelectButton.Name] = SelectButton.MouseButton1Click:Connect(function()
		ToggleButton(SelectButton, ToggleableButtons.Erase)
	end)

	conns[EraseButton.Name] = EraseButton.MouseButton1Click:Connect(function()
		ToggleButton(EraseButton, ToggleableButtons.Erase)
	end)
	
	conns[TrackNumber_RightButton.Name] = TrackNumber_RightButton.MouseButton1Click:Connect(function()
		setTrack(currentTrack+1)
	end)
	
	conns[TrackNumber_RightButton.Name] = TrackNumber_LeftButton.MouseButton1Click:Connect(function()
		setTrack(currentTrack-1)
	end)
end

local function resetConns()
	for _, conn in pairs(conns) do
		if conn then
			conn:Disconnect()
			conn = nil
		end
	end
	
	print("CONNS: ", conns)
end

function setTrack(Track: number)
	if not Track or typeof(Track) ~= "number" then return end
	if not TrackData[Track] then return end

	currentTrack = Track
	module:ResetAll()

	InitSlider()
	setLabels()
	buttonConns()
end

function module:ResetAll()
	resetConns()
	setLabels(true)
end

function module:Enable()
	setTrack(currentTrack)
end

function module:Disable()
	module:ResetAll()
end

function module:Init()
	Event.OnClientEvent:Connect(function()
		if gui.Parent ~= PlayerGui then
			gui.Parent = PlayerGui
			module:Enable()
		end
	end)
	
	ExitButton.MouseButton1Click:Connect(function()
		if gui.Parent == PlayerGui then
			gui.Parent = script
			module:Disable()
		end
	end)
end

return module

I’ve tried

  • Changing it to .Destroy instead of :Destroy()
  • Removing the ResetConns() function
  • Removing TrackVolume_Slider.Released function from the conns table
  • Removing the destroy function entirely (doesnt let me create another slider on the same frame)

Any help is appreciated since I have no idea how to even start to fix this.

After reviewing both your script and the source code of the provided module, I see no problems aside from a line count discrepancy in your stack trace. Have you modified the module? Are you showing us your entire script?