Why are these arguments not being passed through a bindable?

Hello, I have run into the issue where arugments are not being accepted into a bindable.

Things to note

  1. The Argument is a string; a Dictionary converted into a string.
  2. Other bindables in the same function of the script work.
  3. I have tried the :Connect(function(...) end)
  4. I have triend function A(...) end; :Connect(A)

Now, with that out of the way, here is the code

Here is the code

Excavator Client

math.randomseed(tick())

local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClientGlobalReferences = require(ReplicatedStorage:WaitForChild("ClientGlobalReferences"))
local RemoteTablePacking = require(ClientGlobalReferences.RemoteTablePacking)
local DestructibleSettingsUtility = require(ClientGlobalReferences.DestructibleSettingsUtility)
local GearClient = require(script.Parent:WaitForChild("GearClient"))

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local guiBindables = PlayerGui:WaitForChild("Bindables")
local initDestructibleBar = guiBindables:WaitForChild("InitDestructibleBar")
local stopDestructibleBar = guiBindables:WaitForChild("StopDestructibleBar")
local updateDestructibleBar = guiBindables:WaitForChild("UpdateDestructibleBar")

local Pickaxe = {}
Pickaxe.__index = Pickaxe
setmetatable(Pickaxe, GearClient)

local function createDestructionEffect(cf, size, color)
	if color == nil then color = Color3.fromRGB(255, 7, 65) end
	local effectPart = Instance.new("Part")
	effectPart.Material = Enum.Material.Neon
	effectPart.Anchored = true
	effectPart.CanCollide = false
	effectPart.CFrame = cf
	effectPart.Size = size
	effectPart.Color = color
	effectPart.Transparency = 0.5
	effectPart.Parent = workspace.Dump
	local randomAngles = CFrame.Angles(math.rad(math.random(-10, 10)), math.rad(math.random(-10, 10)), math.rad(math.random(-10, 10)))
	local tweenInf = TweenInfo.new(0.5,Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
	local tween = TweenService:Create(effectPart, tweenInf, 
		{Size = size + Vector3.new(3,3,3), CFrame = cf * randomAngles, Transparency = 1})
	tween:Play()
	game.Debris:AddItem(effectPart, 1)
end
function Pickaxe:CreateSelection(part)
	if self.SelectionBox.Adornee == part then return end
	self.SelectionBox.Adornee = part
end

function Pickaxe:BindHandlers()
	local updateSelection = RunService.Heartbeat:Connect(function()
		if self.SelectedPart == nil then 
			self:CreateSelection(nil) 
			return 
		end
		if self.SelectedDestructibleName ~= self.SelectedPart.Name then
			local destructibleName = self.SelectedPart.Name
			self.SelectedDestructibleName = destructibleName
			local destructibleSettings = DestructibleSettingsUtility:GetSettingsFor(destructibleName)
			if destructibleSettings then
				destructibleSettings = require(destructibleSettings)
				for k, v in pairs(destructibleSettings) do
					self.SelectedDestructibleData[k] = v
				end
			end
		end
		if self.SelectedPart:IsDescendantOf(workspace.Destructible) and self.SelectedPart ~= self.LastSelectedPart then
			self:CreateSelection(self.SelectedPart)
		elseif not self.SelectedPart:IsDescendantOf(workspace.Destructible) then
			self:CreateSelection(nil)
			return
		end
	end)
	local startDestroying = UserInputService.InputBegan:connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			self.Destroying = true
			local destroyingThread = coroutine.create(function()
				if not self.SelectedPart:IsDescendantOf(workspace.Destructible)
				then return end
				local selectedDestructibleData = self.SelectedDestructibleData
				local selectedDestructible = self.SelectedPart
				local selectedDestructibleSize = self.SelectedPart.Size
				local DPS = self.Config.DegradePerSecond
				local degrade = 0.03 * DPS
				local hp = selectedDestructibleData.TimeToDestroy
				local totalDamage = 0
				
				local packedData = RemoteTablePacking:PackTable(selectedDestructibleData)
				initDestructibleBar:Fire(packedData)
				
				spawn(function()
					local tweenTime = 0.1
					repeat
					local tweenInf = TweenInfo.new(tweenTime, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut, 0, true)
					local tween = TweenService:Create(selectedDestructible, tweenInf, {Size = selectedDestructibleSize + Vector3.new(1,1,1)})
					tween:Play()
					wait(tweenTime * 2)
					until self.Destroying == false
				end)
				print("hi")
				--Requires remote table packing as it is a dictonary
				--local packedData = RemoteTablePacking:PackTable(selectedDestructibleData)
				--initDestructibleBar:Fire(packedData)
				
				repeat wait(0.03)
					totalDamage = totalDamage + degrade
					updateDestructibleBar:Fire(degrade)
					if math.floor(totalDamage / hp * 100) % 10 == 0 then
						createDestructionEffect(selectedDestructible.CFrame, selectedDestructibleSize)
					end
				until totalDamage >= hp or self.Destroying == false
				stopDestructibleBar:Fire()
				self.Destroying = false
				if totalDamage >= hp then
					self.DestroyDestructibleRemote:FireServer(selectedDestructible)
				end
			end)
			coroutine.resume(destroyingThread)
		end
	end)
	
	local stopDestroying = UserInputService.InputEnded:connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			self.Destroying = false
		end
	end)
	table.insert(self.Handlers, startDestroying)
	table.insert(self.Handlers, stopDestroying)
	table.insert(self.Handlers, updateSelection)
end

function Pickaxe.new(tool, Config)
	local newPickaxe = GearClient.new(tool, Config)
	setmetatable(newPickaxe, Pickaxe)
	--[[
	newPickaxe.Tool.Equipped:Connect(function()
		--print("hi")
		newPickaxe:BindHandlers()
	end)
	--]]
	newPickaxe.Destroying = false
	
	newPickaxe.SelectionBox = Instance.new("SelectionBox")
	newPickaxe.SelectionBox.Color3 = Color3.fromRGB(147, 255, 252)
	newPickaxe.SelectionBox.SurfaceColor3 = Color3.fromRGB(155, 255, 140)
	newPickaxe.SelectionBox.LineThickness = 0.05
	newPickaxe.SelectionBox.Parent = newPickaxe.Tool
	
	local selectionEffects = coroutine.create(function()
		local tweenTime = 1
		local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 1, true)
		local tween = TweenService:Create(newPickaxe.SelectionBox, tweenInfo, 
			{Color3 = Color3.fromRGB(155, 255, 140),
			SurfaceTransparency = 0.95,
			LineThickness = 0.1})
		while true do
			tween:Play()
			wait(tweenTime * 2)
		end
	end)
	
	coroutine.resume(selectionEffects)
	
	newPickaxe.SelectedDestructibleName = ""
	newPickaxe.SelectedDestructibleData = {}
	
	newPickaxe.DestroyDestructibleRemote = newPickaxe.Tool:FindFirstChild("DestroyDestructible")
	if newPickaxe.DestroyDestructibleRemote == nil then
		warn("Missing required remote in roder for gear function!")
	end
	
	newPickaxe:BindHandlers()
	
	return newPickaxe
end

return Pickaxe

Here is the code for the progress bar of where im having issues

local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClientGlobalReferences = require(ReplicatedStorage:WaitForChild("ClientGlobalReferences"))
local RemoteTablePacking = require(ClientGlobalReferences.RemoteTablePacking)

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

local initDestructibleBar = bindables:WaitForChild("StopDestructibleBar")
local updateDestructibleBar = bindables:WaitForChild("UpdateDestructibleBar")
local stopDestructibleBar = bindables:WaitForChild("StopDestructibleBar")

local gui = script.Parent
local progressBar = gui:WaitForChild("ProgressBar")
local progressBarFrame = progressBar:WaitForChild("ProgressBarFrame")
local degradePercentDisplay = progressBar:WaitForChild("DegradePercent")
local destructibleLable = gui:WaitForChild("DestructibleLable")
local progressBarFrameSize = progressBarFrame.Size

local baseTweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

local totalDegrade = 0
local timeToMine = 1

local function updateBar()
	local percent = 1 - (totalDegrade / timeToMine)
	print(totalDegrade)
	print(timeToMine)
	print(percent)
	degradePercentDisplay.Text = percent.."%"
	local newSize  = UDim2.new(
		percent,
		progressBarFrameSize.X.Offset,
		1,
		progressBarFrameSize.Y.Offset
	)
	progressBarFrame.Size = newSize
	--local newTween = TweenService:Create(progressBarFrame, baseTweenInfo, {Size = newSize})
	--newTween:Play()
end

local function enableBar()
	local tweenA = TweenService:Create(progressBarFrame, baseTweenInfo, {BackgroundTransparency = 0})
	local tweenB = TweenService:Create(degradePercentDisplay, baseTweenInfo, {TextTransparency = 0})
	local tweenC = TweenService:Create(destructibleLable, baseTweenInfo, {TextTransparency = 0})
	tweenA:Play()
	tweenB:Play()
	tweenC:Play()
end

local function disableBar()
	local tweenA = TweenService:Create(progressBarFrame, baseTweenInfo, {BackgroundTransparency = 1})
	local tweenB = TweenService:Create(degradePercentDisplay, baseTweenInfo, {TextTransparency = 1})
	local tweenC = TweenService:Create(destructibleLable, baseTweenInfo, {TextTransparency = 1})
	tweenA:Play()
	tweenB:Play()
	tweenC:Play()
end

local function initDestructibleBarFunc(destructibleSettings) --issue is here, wont accept arguments
	print(destructibleSettings)
	local destructibleSettings = RemoteTablePacking:UnpackTable(destructibleSettings)
	timeToMine = destructibleSettings.TimeToMine
	print(timeToMine)
	degradePercentDisplay.TextColor3 = destructibleSettings.DestroyTextColor
	degradePercentDisplay.TextStrokeColor3 = destructibleSettings.DestroyTextStrokeColor
	destructibleLable.TextColor3 = destructibleSettings.DestroyTextColor
	destructibleLable.TextStrokeColor3 = destructibleSettings.DestroyTextStrokeColor
	progressBar.BackgroundColor3 = destructibleSettings.ColorSchemeMain
	progressBar.BorderColor3 = destructibleSettings.ColorSchemeSecondary
	progressBarFrame.BackgroundColor3 = destructibleSettings.ColorSchemeMain
	progressBarFrame.BorderColor3 = destructibleSettings.ColorSchemeSecondary
	destructibleLable.Text = destructibleSettings.Name
	enableBar()
end
initDestructibleBar.Event:Connect(initDestructibleBarFunc)

updateDestructibleBar.Event:Connect(function(degrade)
	totalDegrade = totalDegrade + degrade
	updateBar()
end)

stopDestructibleBar.Event:Connect(function()
	disableBar()
	totalDegrade = 1
	timeToMine = 1
	updateBar()
end)
1 Like

Looking at your question, This page may help you (read it carefully):

There is some limitations on the arguments that can be passed to bindables.

That is not the issue; The bindable is initDestructibleBar; The only argument is a string.

1 Like

It was only a small typo; how peculiar