Exception while signaling: Must be a LuaSourceContainer

It might just be me, but I don’t feel this error has been touched on enough by documentation. There is also no linked source for the error in Output, or any reason. (the error relates to studio)

Currently, “exception while signaling: Must be a LuaSourceContainer” error occurs whenever I equip a tool within my game. In my code for the tools, there is only a select few with Equipped signals, any relations? I’m not at all sure. I heard the error corresponds with yielding and threading or accessing nil objects.

I have attempted to disable scripts, it still happens. I’ve recoded things, it still happens. I have tried testing in different places, it still happens.

There is not too much documentation on this, other than documentation of the LuaSourceContainer class, maybe I’m missing something or I didn’t get the memo.

Here is an example of the error occurring when equipping tools. (using autoclicker)

1 Like

Huh, that’s interesting, can you show the script?

-- Instances
local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")

-- Declarations
local HealAmount = 1.6
local Heals = true

local Sounds = {
	["EatSound"] = "http://www.roblox.com/asset/?id=19284093",
	["OpenSound"] = "http://www.roblox.com/asset/?id=19250604"
}

local LoadedSounds = {}

-- Functions
local function LoadSounds() : nil
	for SoundName, SoundId in Sounds do
		if SoundId and type(SoundId) == "string" then
			local Sound = Instance.new("Sound")
			Sound.Parent = Handle
			Sound.Name = SoundName
			Sound.SoundId = SoundId
			Sound.Volume = 1

			if LoadedSounds[SoundName] then
				LoadedSounds[SoundName] = nil
				Sound:Destroy()
			end
			LoadedSounds[SoundName] = Sound
		end
	end
end

local function PlaySound(SoundName : string) : nil
	if SoundName and type(SoundName) == "string" then
		local Sound = LoadedSounds[SoundName]
		Sound:Play()
	else
		warn("Invalid sound name.")
	end
end

local function onActivated()
	if Tool.Enabled  then
		Tool.Enabled = false

		Tool.GripForward = Vector3.new(-1, 0, -0)
		Tool.GripPos = Vector3.new(-.7, .25, -1.7)
		Tool.GripRight = Vector3.new(0, 0, -1)
		Tool.GripUp = Vector3.new(0, 1, 0)
		PlaySound("EatSound")

		task.wait(1)

		local Humanoid = Tool.Parent:FindFirstChildOfClass("Humanoid")
		if Humanoid and Heals then
			Humanoid.Health = math.clamp(Humanoid.Health + HealAmount, 0, Humanoid.MaxHealth)
		end

		Tool.GripForward = Vector3.new(-1, 0, 0)
		Tool.GripPos = Vector3.new(.1, 0, 0)
		Tool.GripRight = Vector3.new(0, 0, -1)
		Tool.GripUp = Vector3.new(0,1,0)
		
		Tool.Enabled = true
	end
end

local function onEquipped()
	PlaySound("OpenSound")
end

-- Calls
LoadSounds()

-- Connections
Tool.Activated:Connect(onActivated)
Tool.Equipped:Connect(onEquipped)

All the tools are recoded versions of their respective ROBLOX gears.

Just add a cooldown when the tool is equipped. like Disabling CoreGui Backpack for a certain duration if tools are equipped with a autoclicker as example.

local player = game.Players.LocalPlayer
local backpack = player.Backpack
local playerGui = player.PlayerGui
local toolLimit = 5
local disableDuration = 10
local isBackpackDisabled = false

function countEquippedTools()
local count = 0
for _, tool in pairs(backpack:GetChildren()) do
if tool:IsA(“Tool”) then
count = count + 1
end
end
return count
end

function disableBackpack()
isBackpackDisabled = true
playerGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
wait(disableDuration)
playerGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
isBackpackDisabled = false
end

function onChildAdded(child)
if not isBackpackDisabled and countEquippedTools() > toolLimit then
disableBackpack()
end
end

backpack.ChildAdded:Connect(onChildAdded)

Autoclicking is not the issue.

Oh Alright, can you send me the hole error in the output so i can try to help you with it?

That’s the entire error in that screenshot, it does not have a linked source, it comes from Studio’s context.

Okay i’ll try to fix this code i’ll reply when i got it fixed thanks for telling me that.

No need, I just would like to know where this error comes from. And how to prevent it from happening. It is capable of stopping threads and yielding code.

I tried using your script and the error “exception while signaling: Must be a LuaSourceContainer” doesn’t appear on my output, i think it’s because of studio acting weird or just the tool being a Roblox Gear? anyway you can try to rescript the script if you want to and see if it still puts out the error if it’s needful for you.

Here is my rescripted version and i really hope that i helped you this is the best solution i can think of:

local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")

local HealAmount = 1.6
local Heals = true

local EatSound = Instance.new("Sound")
EatSound.Parent = Handle
EatSound.Name = "EatSound"
EatSound.SoundId = "http://www.roblox.com/asset/?id=19284093"
EatSound.Volume = 1

local OpenSound = Instance.new("Sound")
OpenSound.Parent = Handle
OpenSound.Name = "OpenSound"
OpenSound.SoundId = "http://www.roblox.com/asset/?id=19250604"
OpenSound.Volume = 1

Tool.Activated:Connect(function()
	if Tool.Enabled then
		Tool.Enabled = false

		Tool.GripForward = Vector3.new(-1, 0, -0)
		Tool.GripPos = Vector3.new(-.7, .25, -1.7)
		Tool.GripRight = Vector3.new(0, 0, -1)
		Tool.GripUp = Vector3.new(0, 1, 0)

		EatSound:Play()

		task.wait(1)

		local Humanoid = Tool.Parent:FindFirstChildOfClass("Humanoid")
		if Humanoid and Heals then
			Humanoid.Health = math.clamp(Humanoid.Health + HealAmount, 0, Humanoid.MaxHealth)
		end

		Tool.GripForward = Vector3.new(-1, 0, 0)
		Tool.GripPos = Vector3.new(.1, 0, 0)
		Tool.GripRight = Vector3.new(0, 0, -1)
		Tool.GripUp = Vector3.new(0, 1, 0)

		Tool.Enabled = true
	end
end)

Tool.Equipped:Connect(function()
	OpenSound:Play()
end)

This did not help, your code is just a slightly modified version of my code.

Yes that’s what said “Rescripted version”