Exception while signaling: Must be a LuaSourceContainer

Hi, I use the following script in a Regen button for vehicles. Whenever the event is fired, the “exception while signaling: Must be a LuaSourceContainer” error pops up twice. It does follow expected behavior however. I’m not even sure it matters at that point, but I would like to know how to avoid it.

local deb = true
local part = script.Parent
local model = part.Parent:FindFirstChildOfClass("Model")
local backup = model:Clone()
local MarketPlace = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Team = script.Parent.Parent.Parent.Parent.Parent.Name
local regened = ReplicatedStorage.Regens:FindFirstChild(Team).Fighter

local function regenerate()
	regened:Fire()
	task.wait()
	model:Destroy()
	part.BrickColor = BrickColor.new("Dark stone grey")
	task.wait(2)
	model = backup:Clone()
	model.Parent = part.Parent
	model:MakeJoints()
	part.BrickColor = BrickColor.new("Bright violet")
	deb = true
end

local function onHit(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		local player = Players:FindFirstChild(hit.Parent.Name)
		if player.TeamColor == BrickColor.new(part.Parent.Parent.Parent.Name) or MarketPlace:UserOwnsGamePassAsync(player.UserId, 1238574) then
			if deb == true then
				deb = false
				regenerate()
			end
		else
			MarketPlace:PromptGamePassPurchase(player, 1238574)		
		end
	end
end

part.Touched:Connect(onHit)

Only other topic I could find regarding this, which is close enough, is the following: Exception while signaling: Must be a LuaSourceContainer - Help and Feedback / Scripting Support - DevForum | Roblox

Thank you in advance

i had the same issue but its solved but i dont know how it got solved

ah the link is at my topic Ok .

you’re maybe rendering too much of objects?? (Creating cloning deleting etc.)

try making the script a little less efficient

That’s a very interesting error… LuaSourceContainer is the top most ancestor for script objects.
Is the error just in red by itself, or is there blue text along with it?

Aha! Here is a script that someone helped me to fix the problem:

--// Variables \\--
local deb = true
local part = script.Parent
local model = part.Parent:FindFirstChildOfClass("Model")
local Backup = model:Clone() -- Example that can cause issues. At my topic when i try to delete the block it causes the issue Maybe its because of this. Try using datatstore or anything.
local MarketPlace = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Team = script.Parent.Parent.Parent.Parent.Parent.Name
local Regened = ReplicatedStorage.Regens:FindFirstChild(Team).Fighter
--// Script \\--
local function regenerate()
	regened:Fire()
	task.wait()
	model:Destroy() -- Example that can cause this
	part.BrickColor = BrickColor.new("Dark stone grey")
	task.wait(2)
	model = backup:Clone() -- the same thing
	model.Parent = part.Parent
	model:MakeJoints()
	part.BrickColor = BrickColor.new("Bright violet")
	deb = true
end

local function onHit(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		local player = Players:FindFirstChild(hit.Parent.Name)
		if player.TeamColor == BrickColor.new(part.Parent.Parent.Parent.Name) or MarketPlace:UserOwnsGamePassAsync(player.UserId, 1238574) then
			if deb == true then
				deb = false
                                wait(1) -- try adding a wait so the function wont keep running
				regenerate()
			end
		else
			MarketPlace:PromptGamePassPurchase(player, 1238574)		
		end
	end
end

part.Touched:Connect(onHit)

it either because of the so much .Parent

the error matter until nothing is wrong. for me the problem printed over 4K times so it’s a huge issue
if it only 2 times then either it’s a good or bad thing

It’s just the error in red by itself (2x). I found it very interesting as well, as it break the entire functionality, but it doesn’t.

Adding the wait did not fix it. And it doesn’t seem like a big problem, but I would still like to understand and fix it haha. The thing is about destroying, cloning and parenting, is that it doesn’t change anything for the script, or any of the script parents it’s located in.