Bindable event returning outdated information

Hello, I have a for loop that runs every 0.1 seconds and looks something like this:

while wait(.1) do
	for i, item in ipairs(workspace.People:GetChildren()) do
		script.Actor:SendMessage('Instruction', {instructiontable})
		retursignal.Event:Once(function(v, guid)
			print(guid)
		end)
	end
end

while the actor script looks like this:

script.Parent:BindToMessageParallel('Instruction', @native function(instruction)
	local id = game:GetService('HttpService'):GenerateGUID(false)
	returnevent:Fire(stuff, id)
	print('event fired with id ' .. id)
end)

I couldn’t find anything about :Once replacing items so I would expect it to work as a normal bindable event connection, however the output looks like this:

Image 05-08-2024 at 16.14

Moreover, if I add a wait() in the loop the behavior becomes normal, and the id received reflects the id it was sent with.

Is this an engine bug or is there anything I can do to prevent it?

never mind, it turns out this behavior exists with :Connect as well

1 Like