Bindable events communicating variables with the wrong values

I’m trying to communicate a variable between localscripts using a bindable event
I tell it to print each variable and it prints the correct values once, but on a second line it prints values of other variables in the original localscript

portion of the main localscript

script.Parent.Equipped:Connect(function() 

	game.ReplicatedStorage.gui:Fire(gunname,cammo, gundamage)

receiving script

textbox = script.Parent
game.ReplicatedStorage.gui.Event:Connect(function(gunname,cammo, b)
print(gunname,cammo,b)

	textbox.Text = gunname
end)

gunname = “Tec-9”
cammo = 32
gundamage(aka ‘b’) = 25
it prints these values in order on one line and then on another line prints “32,2,3” which are all other variables from the sending script

I use this same event in another very similar localscript, and it works flawlessly.
I have no idea why it is doing this, please help

Does it do it if you use separate print statements?

print(gunname)
print(cammo)
print(b)

yeah, it prints the 3 correct values in 3 lines and then the wrong values in the next 3

What happens if you call it like this?:

game.ReplicatedStorage.gui:Fire(gunname,cammo, gundamage, nil)

the second time it prints, it just prints 2 again

Can you show what you mean by that?

it prints
Tec-9
32
25
nil
32
2
3
2
the first 4 are the actual values and the last 4 are the ones that are used by the receiving localscript

I was using the same bindevent for 2 different things so separating them fixed this problem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.