Home > Enterprise >  exception while signaling: Must be a LuaSourceContainer
exception while signaling: Must be a LuaSourceContainer

Time:06-15

So I was just making game on Roblox and met strange exception:

exception while signaling: Must be a LuaSourceContainer - Studio

I think it comes from my own custom humanoid UI, but I am not sure. Any suggestions how to fix it?

CodePudding user response:

So, I found out what I am doing wrong. I used

Humanoid.HealthChanged.Connect:(function()
--Changing UI
end)

When I needed to do something like this:

Humanoid:GetAttributeChangedSignal("Health"):Connect(function() 
--Function body
end)

But unfortunately, only Players have attribute Health. So, I used repeat loop until my humanoid health reaches (<=) 0. Very important to mention that if you use Humanoid.Died signal, you will instantly leave loop. I redid code and now it looks like this:

repeat
--Function body
wait(0.01) --NOTE: If you won't use wait(), you will freeze studio and get error.
until Humanoid.Health <= 0

Hopefully, this was helpful to anyone.

  • Related