Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Some help with unpacking and parameters?

I haven't been able to figure out what order to do unpacking for my script. The first one a table starts in is:

while wait(1) do
	
	if match.Value == true then
	
		game.ReplicatedStorage.TeleportPlayers:Fire(QueuedPlayers)
		
	end
end

Then if I type in:

print(unpack(QueuedPlayers)

It will print My user fine. However, when I send this to another script the values are just gone. Here is the next script that it should be printed in:


local QueuedPlayers2 = {}

game.ReplicatedStorage.TeleportPlayers.Event:Connect(function(QueuedPlayers)
	
	
	local QueuedPlayers2 = QueuedPlayers
	
	
end)

I add:

print(unpack(QueuedPlayers2)

and it gives me nothing, why is this?

1 answer

✓ Accepted answer

Your BindableEvent is set up just fine. You just made a really dumb mistake, probably because you're overthinking this. You redeclared your QueuedPlayers2 variable inside your function, and then set it equal to QueuedPlayers. My question is, why? Why not just use print(unpack(QueuedPlayers))? Regardless, here's the fixed code.

game.ReplicatedStorage.TeleportPlayers.Event:Connect(function(QueuedPlayers)
	print(unpack(QueuedPlayers))
end)

1 comment

1

I kept trying to unpack it in the other script and this one (¬?¬) thanks your your help though!

This discussion is preserved as it was. New answers, comments, and votes are closed.