ModuleScript communication loses some data?

for _,Attack in pairs (PlayerAttacks) do
			print(Attack.TargetType)
			if Attack.Target.BattleInfo.Alive.Value == false then Attack.Target = Enemies[math.random(1,#Enemies)] end
			print(Attack.TargetType)
			PlayerAttackScript(Attack,CharactersInBattle,Stage)
		end

Is send to:

return function(Attack,AllPlrs,Stage)
	local Target = Attack.Target
	local Attacker = Attack.Attacker
	local Attack = Attack.Attack
	local TargetType = Attack.TargetType
	print(Target,Attacker,Attack,TargetType)

Output:
image
Why doesn’t TargetType get printed out correctly in the second script?

Tried:
PlayerAttackScript(Attack, Attack.TargetType ,CharactersInBattle,Stage) still prints out nil on Attack.TargetType.

1 Like

I don’t think you created the variable Attack.TargetType anywhere. I can’t find it.

Remote Events from Client to Server always returns the player instance in the argument. I’m not sure if this is the issue, but did you make sure the player is accounted in the Remote Event?

remoteEvent.OnServerEvent:Connect(function(player, blah, bloh, bleh)

end)

Sorry, my head is so full today that I mistyped the title. It’s actually communication between modulescripts where it somehow loses Attack.TargetType string.

1 Like

Uhmm, somehow solved it by setting Attack.TypeTarget as argument, while my previous attempt didnt work…?