Varaible being reset after else statement - how to get around?

heres what i have

function ToolHandlerModule.PlayerParentHandler(Item, Player)
	
	
	if Item.Parent.Parent ~= game.Players then
		if Item.Parent.Parent.Parent == game.Players then
			Player = Item.Parent.Parent
			
			local ItemCosmetic = Item:FindFirstChild("CosmeticValue").Value
			SlingHandler.SlingItem(Player, ItemCosmetic, false)
			
			print(Player, "before")
			
		else
			if not Item.Parent.Parent:FindFirstChild("Humanoid") then
				
				print(Player, "after")
				
				local ItemCosmeticUn = Item:FindFirstChild("CosmeticValue").Value
				SlingHandler.UnslingItem(Player, ItemCosmeticUn)
				
				
			end
		end		
	end
end

i want the player varaible from before the else statement to be saved so i can use it to send to a module but it gets reset, is there a way to get around this?

  15:21:18.171  aeroactual before  -  Server - ToolHandler:27
  15:21:20.103  nil after  -  Server - ToolHandler:32

looks like you aren’t always parsing the Player into the function. Maybe check the code that’s calling calling the function?

look at the parameters where you define the function, sounds like you’ve got duplicate variable names