Error with values

Hello! I have two values: pp and pa. pp is player object (Player1) and pa (Player2) and i checked it with print, but…
In script after i printed it it seems luke pp is Player1 and pa is Player1 too… I don’t know why, just check code:

t.Ready.OnServerEvent:Connect(function(p, k, s)
	print("Fire")
	print(p)
	print(k)
	print(s)
	if game.Players:WaitForChild(s).PlayerGui.Trade.Trading.r.Value == true then
		
		print("Fire")
		if game.Players:WaitForChild(s).PlayerGui.Trade.Trading.r.Value == true then
			local p2 = game.Players:WaitForChild(s).PlayerGui.Trade.Trading.PetsReq.Value:split(',')
			local p1 = p.PlayerGui.Trade.Trading.PetsReq.Value:split(',')
			local pp = p
			local pa = game.Players:WaitForChild(s)
			
			print(pp.Name.. " - plr 1")
			print(pa.Name.. " - plr 2")
			
			pp.PlayerGui.Trade:Destroy()
			pa.PlayerGui.Trade:Destroy()
			
			game.ReplicatedStorage.RemoteEvents.Message:FireClient(pp, "Trade success!")
			game.ReplicatedStorage.RemoteEvents.Message:FireClient(pa, "Trade success!")
			
			for _,v in p1 do
				for _,pet in ipairs(pp:WaitForChild("Pets"):GetChildren()) do
					if pet.Pet_ID.Value == v then
						print("Gived pet")
						print(pp.." - giver,"..pa.." - obtainer")
						local PetObject = Instance.new("Folder", pa.Pets)
						local Equipped = Instance.new("BoolValue",PetObject)
						local XP = Instance.new("NumberValue",PetObject)
						local Pet_ID = Instance.new("NumberValue", PetObject)
						local Multiplier = Instance.new("NumberValue", PetObject)
						local GemM = Instance.new("NumberValue", PetObject)
						local Enchants = Instance.new("StringValue", PetObject)
						Equipped.Name = "Equipped"
						XP.Name = "XP"
						Pet_ID.Name = "Pet_ID"
						Multiplier.Name = "Multiplier"
						GemM.Name = "Gem"
						PetObject.Name = pet.Name
						Equipped.Value = false
						XP.Value = pet.XP.Value
						Multiplier.Value = pet.Multiplier.Value
						GemM.Value = pet.Gem.Value
						Pet_ID.Value = #pp.Pets:GetChildren()+1
						Enchants.Name = "Enchants"
						Enchants.Value = pet.Enchants.Value
						pet:Destroy()
						game.ReplicatedStorage.RemoteEvents.ChangePetsValue:FireClient(pa, "TotalPets")
						game.ReplicatedStorage.RemoteEvents.PetAquired:FireClient(pa, PetObject.Name, Pet_ID.Value)
						print(pa.Name.. " aquired")
						break
					else
						print("Incorrect pet_id: ".. pet.Pet_ID.Value..","..v)
					end
				end
			end

			for _,v in p2 do
				for _,pet in ipairs(pa:WaitForChild("Pets"):GetChildren()) do
					if pet.Pet_ID.Value == tonumber(v) then
						print("Gived pet")
						print(pa.Name.." - giver,"..pp.Name.." - obtainer")
						local PetObject = Instance.new("Folder", pp.Pets)
						local Equipped = Instance.new("BoolValue",PetObject)
						local XP = Instance.new("NumberValue",PetObject)
						local Pet_ID = Instance.new("NumberValue", PetObject)
						local Multiplier = Instance.new("NumberValue", PetObject)
						local GemM = Instance.new("NumberValue", PetObject)
						local Enchants = Instance.new("StringValue", PetObject)
						Equipped.Name = "Equipped"
						XP.Name = "XP"
						Pet_ID.Name = "Pet_ID"
						Multiplier.Name = "Multiplier"
						GemM.Name = "Gem"
						PetObject.Name = pet.Name
						Equipped.Value = false
						XP.Value = pet.XP.Value
						Multiplier.Value = pet.Multiplier.Value
						GemM.Value = pet.Gem.Value
						Pet_ID.Value = #pp.Pets:GetChildren()+1
						Enchants.Name = "Enchants"
						Enchants.Value = pet.Enchants.Value
						pet:Destroy()
						game.ReplicatedStorage.RemoteEvents.ChangePetsValue:FireClient(pp, "TotalPets")
						game.ReplicatedStorage.RemoteEvents.PetAquired:FireClient(pp, PetObject.Name, Pet_ID.Value)
						print(pp.Name.. " aquired")
						break
					else
						print("Incorrect pet_id: ".. pet.Pet_ID.Value..","..v)
					end
				end
			end
			
			local c1 = game.ServerStorage.Guis.Trade:Clone()
			c1.Parent = pp.PlayerGui
			
			local c2 = game.ServerStorage.Guis.Trade:Clone()
			c2.Parent = pa.PlayerGui
			
			print("Trade success!")
		else
			print("no")
		end
	else
		print("no")
	end
end)

It prints:

  22:40:49.105  Player2  -  Server - TradeHandler:48
  22:40:49.105  0  -  Server - TradeHandler:49
  22:40:49.105  Player1  -  Server - TradeHandler:50
  22:40:49.106  no  -  Server - TradeHandler:152
  22:40:51.457  Fire  -  Server - TradeHandler:47
  22:40:51.457  Player1  -  Server - TradeHandler:48
  22:40:51.457  0  -  Server - TradeHandler:49
  22:40:51.458  Player2  -  Server - TradeHandler:50
  22:40:51.458  Fire  -  Server - TradeHandler:53
  22:40:51.458  Player1 - plr 1  -  Server - TradeHandler:60
  22:40:51.458  Player2 - plr 2  -  Server - TradeHandler:61
  22:40:51.463  Incorrect pet_id: 1, (x2)  -  Server - TradeHandler:100
  22:40:51.464  Incorrect pet_id: 1, (x2)  -  Server - TradeHandler:136
  22:40:51.464  Gived pet  -  Server - TradeHandler:108
  22:40:51.464  Player2 - giver,Player1 - obtainer  -  Server - TradeHandler:109
  22:40:51.465  Player1 aquired  -  Server - TradeHandler:133
  22:40:51.465  Gived pet  -  Server - TradeHandler:108
  22:40:51.465  Player2 - giver,Player1 - obtainer  -  Server - TradeHandler:109
  22:40:51.466  Player1 aquired  -  Server - TradeHandler:133
  22:40:51.468  Trade success!  -  Server - TradeHandler:147
1 Like

Is it?
Because by looking at your output for

print(pp.Name.. " - plr 1")
print(pa.Name.. " - plr 2")

it prints

  22:40:51.458  Player1 - plr 1  -  Server - TradeHandler:60
  22:40:51.458  Player2 - plr 2  -  Server - TradeHandler:61
1 Like

Ye, i also litte shocked, but it is

I don’t see anything wrong with the output at the moment. The print itself can’t be wrong. What exactly is not working? Since pp and pa are clearly different players.

You see that after it it prints another values